Update a listbox in a tab on a form

  • Thread starter BTU_needs_assistance_43
  • Start date
B

BTU_needs_assistance_43

I have a list box which is defined by a number in a textbox on any given
record. If I open the query which the list draws its information from and
close it, the record will display the data tied to the record. But if I move
to another record or don't open the query the list box will remain blank or
keep the same data on its table until I open and close the source query
again. Is there a command I should write into the event procedure? On update?
On click? How do I make this list box display the data on its own when I open
the form and switch data when I move to a new record?
 
B

BTU_needs_assistance_43

I'm using Access 2003 and it does not have the On Current event except in the
expression builder. I've tried using On Current there too and it doesn't
work. The only ones that seem to work are when I paste your code
[MyLstBox].[Requery] in the OnClick Event. That will do if I can't make
anything else work, but I'd really just like it to do it when I click on the
next record button on the bottom or type in a specific record number. I
suppose that would probably take a little time for me to sit down an write
some code in VBA?
 
B

BTU_needs_assistance_43

I open the form, go to design mode, right click, select properties, click on
the event tab right after data and right before other, and these are the
options available;

Before Update
After Update
On Enter
On Exit
On Got Focus
On Lost Focus
On Click
On Dbl Click
On Mouse Down
On Mouse Move
On Mouse Up
On Key Down
On Key Up
On Key Press

Thats it. Even if I start a new database and build a new form and listbox
there is no On Current option on the events tab.

JimBurke via AccessMonster.com said:
On Current is a form event. It shouldn't matter what version you're using.
Bring up the form's properties and you should see On Current on the events
tab.

BTU_needs_assistance_43 said:
I'm using Access 2003 and it does not have the On Current event except in the
expression builder. I've tried using On Current there too and it doesn't
work. The only ones that seem to work are when I paste your code
[MyLstBox].[Requery] in the OnClick Event. That will do if I can't make
anything else work, but I'd really just like it to do it when I click on the
next record button on the bottom or type in a specific record number. I
suppose that would probably take a little time for me to sit down an write
some code in VBA?
Assuming that each time you move to a new record that query will have what it
needs to populate the listbox, you should just set the listbox's row source
[quoted text clipped - 15 lines]
On click? How do I make this list box display the data on its own when I open
the form and switch data when I move to a new record?
 
B

BTU_needs_assistance_43

You got it. I wasn't looking at the form properties, just the list box's. And
it works just the way I want it to now. Thank you very much.

JimBurke via AccessMonster.com said:
I was assuming you knew this but maybe not. To look at the form properties
you have to click in the little box in the upper left hand corner, just to
the left of the 'ruler' and above the form header (or detail section if you
don't have the header displayed).

BTU_needs_assistance_43 said:
I open the form, go to design mode, right click, select properties, click on
the event tab right after data and right before other, and these are the
options available;

Before Update
After Update
On Enter
On Exit
On Got Focus
On Lost Focus
On Click
On Dbl Click
On Mouse Down
On Mouse Move
On Mouse Up
On Key Down
On Key Up
On Key Press

Thats it. Even if I start a new database and build a new form and listbox
there is no On Current option on the events tab.
On Current is a form event. It shouldn't matter what version you're using.
Bring up the form's properties and you should see On Current on the events
[quoted text clipped - 14 lines]
On click? How do I make this list box display the data on its own when I open
the form and switch data when I move to a new record?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Access Cannot select items in listbox 1
Next Record in ListBox 2
Finding a record with composite key 6
Listbox Sideways 10
Focus in a list box 4
Listbox Update 4
Queries in VBA 6
How to update a field in a continuous form 4

Top