Solved

Can't get listbox on a form to requery

Posted on 2014-02-24
4
475 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 37

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

751 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