Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

Can't get listbox on a form to requery

I have a form which contains a listbox.  When the use double-clicks in the listbox a 2nd form opens for data entry.  When the 2nd form closes I have this code on the onclose event but the listbox on the main form is not "refreshing".  It looks empty yet if I close the main form and re-open the main form the listbox records are there.

Here's my onclose code of the 2nd form:

    Forms!frmDailyFinishingInput.[List0].Requery

What am I doing wrong?

--Steve
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note too that you must be careful when referring to Subforms:

Forms!frmDailyFinishingInput.YourSubformCONTROL.Form.etc

"YourSubformCONTROL" is the name of the Subform CONTROL on frmDailyFinishingInput. It may or may not be named the same as the form you're using as a SourceObject, so be sure to verify this.
If you use a naming convention, you will never have to guess about whether a name refers to a form, control or other object.  That is one of the advantages of using a naming convention.  I have an add-on that semi-automatically applies the Leszynski Naming Convention (LNC) to database objects and controls.  Here are links for downloading it:

Access 2000-2003 version:
http://www.helenfeddema.com/Files/code10.zip

Access 2007-2010 version:
http://www.helenfeddema.com/Files/code63.zip