Solved

Can't get listbox on a form to requery

Posted on 2014-02-24
4
465 Views
Last Modified: 2014-02-25
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
0
Comment
Question by:SteveL13
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
PatHartman earned 250 total points
ID: 39883905
Forms!frmDailyFinishingInput![List0].Requery

You have a dot where you should have a bang.  I would also check the spelling of everything.  Is the control on the main form because if it is on a subform, the syntax would need to change.

Forms!frmDailyFinishingInput!YOURSUBFORM.Form![List0].Requery
0
 
LVL 31

Assisted Solution

by:Helen_Feddema
Helen_Feddema earned 250 total points
ID: 39884187
Here is some actual code that requeries several listboxes on a subform of the current form.  I set a Form variable to the subform to make the code more compact.  You could just substitute the form name for the Me keyword:

         Set frmSub = Me![subAssignmentTypesTeamAndIndustry].Form
         frmSub![lstToSelectTeam].Requery
         frmSub![lstSelectedTeam].Requery
         frmSub![lstToSelectIndustryTypes].Requery
         frmSub![lstSelectedIndustryTypes].Requery

Open in new window

0
 
LVL 84
ID: 39885487
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.
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 39886662
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now