Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box Updating

Status
Not open for further replies.

JoanieB

Programmer
Apr 17, 2001
57
US
I may need a combo box, but I'm not sure. I need to link the 'box' to a query that counts the number of instances based on the value of the form that is open (the query behind the list/combo specifies the value of the field on the form) It only shows the count of the first record and never changes (I've tried both types of boxes). How can I get it to change with each record the user moves to? Does it have to do with the bound columns or those things in the properties? I've tried looking in my books and playing around with them, but to no avail!
 
Hi Joanie ...

When the data on your form changes, your list box data needs to change also - and the way to make your list box data change is to invoke the Requery method on the list box.

i.e. If your list box is named lstMyList ...

...
'your code here
lstMyList.Requery
'more code here
...

And that's all there is to it. :)

HTH

Greg

When you don't understand, just nod and smile.
 
That was great! But I have a question: can I only do this within the code behind the form? The users will be jumping around alot and using the find button on the toolbox to locate certain records. If I can only requery within the code (next, previous buttons, etc), we may run into probs.
 
That's the On Current event behind the form, right? I think that's it! Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top