Solved

Access Requery

Posted on 2011-03-23
5
223 Views
Last Modified: 2012-05-11
All,

I have an issue with "old" data appearing inside list boxes on a form.

The list boxes are named such as lstRange1, lstRange2, lstRange3 and so forth.

What happens is, I use VB to populate the list boxes when the form opens (as part of a refresh process), however, not all list boxes are populated depending on some conditions. For example lstRange1 might have data but lstRange2 and lstRange3 might not be required. These are greyed out.

My initial thought was to set each list box rowsource to "" on the FormLoad or FormOpen event to make sure that each of the list boxes were blank prior to populating the form with data. However, a colleage mentioned to me that I could use the requery method but I cannot pin point any solid examples as guidance.

Anyone got any suggestions?
0
Comment
Question by:creativefusion
5 Comments
 
LVL 33

Expert Comment

by:Mike Eghtebas
Comment Utility
Are these list boxes supposed to be synchrinized (each lisiting some criteria to select from)?
0
 

Author Comment

by:creativefusion
Comment Utility
No nothing at all. They are just for information and contain two columns of data.
0
 
LVL 44

Accepted Solution

by:
GRayL earned 500 total points
Comment Utility
I think you have it right.  On form_load, populate the ControlSource property of the list boxes appropriately.
0
 
LVL 5

Expert Comment

by:DoveTails
Comment Utility
You'd use the requery to update the list boxes for the user if something has changed in the list (ie. an item added or deleted)
    ie.   Me.lstRange2.Requery

If you want the boxes to be blank for the user, then your idea of setting them to "" makes sense to me.

I think this is what GRayL is getting at.
0
 
LVL 44

Expert Comment

by:GRayL
Comment Utility
Thanks, glad to help.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

762 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

11 Experts available now in Live!

Get 1:1 Help Now