troubleshooting Question

Requerying a listbox

Avatar of jondecker76
jondecker76 asked on
Microsoft Access
10 Comments1 Solution383 ViewsLast Modified:
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
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros