I have a Listobx on a form (Form_A) that is populated by Table_A
There is a button on the same Form_A to Add a record to Table_A.
-CLicking on the "Add" button opens a new form (Form_B) to enter information. Once this information is entered, the information is Inserted into Table_A, and Form_B closes.
The Problem now is that there is new data in Table_A, and the listbox on Form_A has not updated to reflect this.
In my VBA code for the "Add" button on Form A I have tried the following to requery the listbox (thinking it would do the requery after returning from Form_B)
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , CStr(Me.lstTrips.value)
Me.lstAffected.Requery
This did not work, as the Me.lstAffected.Requery would happen before new data was entered on From_B
So now, directly inside the Form_B VBA code, after I execute my SQL statement to add the data, I tried:
Forms.frmModuleData_Trip.lstAffected.Requery
But then I get an error "Object does not support that property or method."
How can I get my listBox on Form_A to requery from VBA code in Form_B?
thanks
try this
Forms![frmModuleData_Trip]
is frmModuleData_Trip the name of Form A you mentioned above?