help with list boxes (1 Viewer)

LazyYogini

New member
Local time
Today, 15:46
Joined
Dec 7, 2021
Messages
4
hello!

I am learning as I go and am a novice so being pointed in the right direction for any learning resources that are specific to listboxes would be very helpful.

I have a search form that inputs parameters into a query. I then have a list box on the search form that lists the results of the query.

I have a requery macro in the after Update event on the list box but I have to actually click on the list box for it to update.How can I have the list box update with the query without having to click on the box?

Thank you in advance!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:46
Joined
May 7, 2009
Messages
19,231
how did you manage to get the result of the query?
do you have another textbox for inputing the criteria of the query?
you will need to move the requery macro from the listbox to the textbox.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 15:46
Joined
Feb 28, 2001
Messages
27,138
Typically, you would have a line of code that does a .Requery on the overall form or on the specific control that you want to reflect the update.

There is some action you perform that you believe will update the contents / list of the list box. In the code related to that updating action, you include a listboxname.Requery before you complete the action. Access does things based on events, i.e. computer recognition of something that has happened, changed, etc. Therefore, you need to find the action that is doing the update and put your related commands in a related event.
 

LazyYogini

New member
Local time
Today, 15:46
Joined
Dec 7, 2021
Messages
4
Typically, you would have a line of code that does a .Requery on the overall form or on the specific control that you want to reflect the update.

There is some action you perform that you believe will update the contents / list of the list box. In the code related to that updating action, you include a listboxname.Requery before you complete the action. Access does things based on events, i.e. computer recognition of something that has happened, changed, etc. Therefore, you need to find the action that is doing the update and put your related commands in a related event.
I am very new to this, so I am a little fuzzy on what you mean. can you be more specific?

I have attached my file. The form i am talking about is the UOM search form
 
Last edited:

LazyYogini

New member
Local time
Today, 15:46
Joined
Dec 7, 2021
Messages
4
how did you manage to get the result of the query?
do you have another textbox for inputing the criteria of the query?
you will need to move the requery macro from the listbox to the textbox.
So my form has two textboxes that are parameters to my query. I have a button that will run the query and then closes the query window. The requery macro is written into the after update event in the list box. but I have to click on the test box for the query results to update in the list box.
 

LazyYogini

New member
Local time
Today, 15:46
Joined
Dec 7, 2021
Messages
4
I figured it out. I needed to put the requery in the after update event on the form. Thanks all.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:46
Joined
May 7, 2009
Messages
19,231
as I have said move your Requery macro.
so you have a button, move it there:

Screenshot_7.png

note: use your Listboxname
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:46
Joined
May 7, 2009
Messages
19,231
I needed to put the requery in the after update event on the form.
you can also do that, but it will take time for that to happen when you
move to another record or save the form.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 15:46
Joined
Feb 28, 2001
Messages
27,138
I figured it out. I needed to put the requery in the after update event on the form. Thanks all.

You are welcome. You put the .Requery in the event that led to the change in the listbox that you wanted to see.
 

Users who are viewing this thread

Top Bottom