UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Conditional Formatting Requery Question, Access 2010    
 
   
dzoker
post Feb 3 2016, 11:38 AM
Post#1



Posts: 371
Joined: 12-February 14



Hi All,

I'm trying to Requery an object so the Conditional formatting would kick in on 2 forms.
The code is behind a form OnClose button. This form is being open either from Form Training Orders or Form tblTrainingEntryAdmin.

The code should work like this:

Check if form TrainingOrders is loaded and if yes then Requery [LastName]
if it's not open then nothing
then check if form tblTrainingEntryAdmin is loaded and if yes Requery [Combo172]
if it's not open then nothing

CODE
Private Sub cmdCloseForm_Click()
    If CurrentProject.AllForms("TrainingOrders").IsLoaded = True Then
Forms!TrainingOrders![LastName].Requery
Forms!TrainingOrders![LastName].SetFocus
    
    ElseIf CurrentProject.AllForms("tblTrainingEntryAdmin").IsLoaded = True Then
Forms!tblTrainingEntryAdmin![Combo172].Requery
Forms!tblTrainingEntryAdmin![Combo172].SetFocus
    End If
    DoCmd.Close
End Sub


EDIT: The problem that I have now is that is not re querying if I open Form tblTrainingEntryAdmin but it's working on form TrainingOrders
Go to the top of the page
 
dashiellx2000
post Feb 3 2016, 12:12 PM
Post#2


UtterAccess VIP
Posts: 9,762
Joined: 11-March 05
From: Maryland


Have you tried stepping through your code to make sure it is responding properly and the steps are executing?
Go to the top of the page
 
dzoker
post Feb 3 2016, 12:22 PM
Post#3



Posts: 371
Joined: 12-February 14



dashiellx2000,

Thanks for your answer. I'm new in Access and still have not learned how to step properly. I followed the link that you gave me and when trying to step through the code in the VBA editor The first line of code got highlighted yellow

CODE
If CurrentProject.AllForms("TrainingOrders").IsLoaded = True Then

What does that mean? I tried searching more on how to Step but so far no luck. I'll try searching some more.

EDIT: Ok I did step through the whole code. Was I supposed to get some error message? Nothing happened after stepping through the code
Go to the top of the page
 
dzoker
post Feb 3 2016, 12:30 PM
Post#4



Posts: 371
Joined: 12-February 14



Disregard. I found out how the step process works. Thank you
Go to the top of the page
 
dzoker
post Feb 3 2016, 12:43 PM
Post#5



Posts: 371
Joined: 12-February 14



Ok I think I found out what the problem is. The second form that opens where the button is with the code is Pop up: yes and modal: yes so it looks like the main form can't be Requery if both are yes.
Go to the top of the page
 
dashiellx2000
post Feb 3 2016, 12:47 PM
Post#6


UtterAccess VIP
Posts: 9,762
Joined: 11-March 05
From: Maryland


This article might be of some use to you: Popup Form vs. Modal Form
Go to the top of the page
 
dzoker
post Feb 3 2016, 12:50 PM
Post#7



Posts: 371
Joined: 12-February 14



dashiellx2000,

Perfect answer for my question.

Thank you thumbup.gif
Go to the top of the page
 
dashiellx2000
post Feb 3 2016, 01:31 PM
Post#8


UtterAccess VIP
Posts: 9,762
Joined: 11-March 05
From: Maryland


yw.gif
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th December 2017 - 10:48 AM