Requery code required

leahb747

Registered User.
Local time
Tomorrow, 03:35
Joined
Jun 12, 2012
Messages
30
I'm trying to fix an old database that has a few broken bits and pieces.

I have a form set up that has, on the main form (frmDayworkEntry) a combo box (cboContract) that the user selects the applicable contract from.

Then, the subform below (sfrmDaywaorkDetailsEntry) has a combobox (txtResourceID) that the user can then choose the applicable resource used (shows 4 columns and fills out the rest of the table automatically). There seems to be a glitch however. Once you fill out the cboContract and go to click on the txtResourceID combo box, it comes up empty. To get it to fill with the appropriate info you have to click around on the page for a bit. And then it works fine. I'm thinking it has something to do with the lack of an After Update Requery, but I'm not entirely sure how to go about coding this.

Any help would be greatly appreciated.

TIA

Leah
 
You can requery the combo on the subform by using this in the after update event of the main form combo:

Me.SubformControlNameHere.Form.ComboNameHere.Requery

so the SubformControlNameHere refers to the control on the main form which displays/houses the subform, but isn't really the subform itself. The name of this control can be exactly the same as the subform but many times it isn't. So, if it isn't the exact same name as the subform then you also have to include the .Form. part as shown so it will know to use the property or method of the subform and not the subform control.
 
It's saying that the Database cannot find the object Me.

This is the code I put in the after Update of the combo box on the main form

Me.sfrmDayworkDatailsEntry.Form.txtResourceID.Requery
 
It's saying that the Database cannot find the object Me.

This is the code I put in the after Update of the combo box on the main form

Me.sfrmDayworkDatailsEntry.Form.txtResourceID.Requery

Did you put that code in the VBA window or in the event PROPERTY? It needs to be in the VBA window and NOT in the property.

See here for where it needs to go:
http://www.btabdevelopment.com/ts/eventcode
 

Users who are viewing this thread

Back
Top Bottom