Last record on a list box

  • Thread starter Thread starter Elsa
  • Start date Start date
E

Elsa

I have a list box "MylistBox" on my form
How do I configure the list box to go to the last record
automatically, every time the form is opened?

Thanks

Elsa
 
Try something along the lines of
yourListBoxControl.Selected(yourListBoxControl.ListCount -
1) = True

Hope This Helps
Gerald Stan;ey MCSD
 
I have an ADD button next to the list box that opens a new
form and adds records.
Every time I create a new record, I want the computer to
add a Sub record for that record.

I have created a form that gets opened hidden and does all
calculation for the sub record and saves it.
However, some information must be pulled from the selected
record on the List box.

How can I have the list box, select the new created record?

Thanks
 
Let's see if I understand your setup
You have Form1 which contains the listBox and an Add Button
Clicking on the Add button results in Form2 being opened.
Completion of Form2 causes a record to be saved and Form3
to be opened hidden from whence a subRecord is stored.

You require the listbox to be updated with data one of
these new records created from Form2 or Form3.

My guess would be to put a call to requery the listbox in
the Unload eventhandler of the form that created the record
that is to appear in the listbox.

A neater solution that you may wish to consider would be to
replace the listBox with a comboBox with its LimitToList
property set to Yes. You would then be able to do away
with the Add button by putting the same code currently in
the click event handler into the comboBox's NotInList
eventHandler. Doing this would result in the dropdown list
being refreshed automatically.

Hope This Helps
Gerald Stanley MCSD
 
Back
Top