Requery a dropdown field (1 Viewer)

Rushman21

Registered User.
Local time
Today, 13:57
Joined
Nov 2, 2011
Messages
23
I have subform in a Main form that has Drop down field named Project Number and two Hours text fields Hrsworked and SPHrsworked. I have it set when you select a specific Project Number, one Hours field is active and the other not active. Example, select Project Number 1, you can add entries in Hrsworked but not in SPHrsworked. Select Project Number 2, Vise-versa. This is working fine.

But if I go back to edit the Hours, I can't input data in either of the Hours field until I re-select the Project Number. I tried a me.requery in both the main form and tried in the subform. But can't get it to work. I just need to know how to re-query (or refresh) the Project Number so I don't have to re-select it every time.

Thank you for your time.
 

Beetle

Duly Registered Boozer
Local time
Today, 14:57
Joined
Apr 30, 2011
Messages
1,808
Try a requery of the Project Number combo box in the Current event of whichever form it is on.

Code:
Private Sub Form_Current()

    Me!cboProject.Requery

End Sub
 

moke123

AWF VIP
Local time
Today, 16:57
Joined
Jan 11, 2013
Messages
3,912
I often use the OnEnter event of the combobox.
 

Beetle

Duly Registered Boozer
Local time
Today, 14:57
Joined
Apr 30, 2011
Messages
1,808
Simply stating that it didn't work does not help get us any closer to a solution. What, exactly, did you try and what was the result (i.e. an error message, an undesired result, no result at all, etc.). You may also try posting a sanitized copy of your application so we can see the issue directly.
 

Rushman21

Registered User.
Local time
Today, 13:57
Joined
Nov 2, 2011
Messages
23
Sorry about that. I put the code under the subform in the On Current. Me!Project_Number.requery. I have attached an example of what is happening. So, the Project Number that has 1501 or 1607, you should only be able to type in the TIBHrsWorked fields. But this is not the case until you create a new entry or if you re-enter an existing project number. Once you re-enter one project number, it all works like it should. But we don't want to have to re-enter every time we open the database. Hope this make's sense.
 
Last edited:

Beetle

Duly Registered Boozer
Local time
Today, 14:57
Joined
Apr 30, 2011
Messages
1,808
OK, just call the Project Number After Update event in the Current event of the sub form;

Code:
Private Sub Form_Current()
    Project_Number_AfterUpdate
End Sub
 

Users who are viewing this thread

Top Bottom