How to synchronize a list box on a form with the form itself

  • Thread starter Thread starter John Doe
  • Start date Start date
J

John Doe

I have a form that is has as its RecordSource a query.

On that form I have a list box that has as its RecordSource that same
query.

The form opens and the list box shows the correct rows of data.

I would like to double-click on a row in the list box and that would
put the data for each field into appropriate controls on the form
where I can then edit the data for each field.

I cannot seem to get things to work. I have checked the MSDN
information and the Help files for information on all of this. I have
even copied some of the code from the examples but that doesn't work
for this form.

Any suggestions on where to turn?
 
John

A more common approach would be to use a combo box in the header of the
form. That combo box would be based on a query that gives the user enough
information to select a record.

The form is based on another query, one which uses, as a criterion for the
record ID, the combo box in the header. The process works something like
this:
User selects record from combo box. (The combo box has, as it's Bound
Column, the column which holds the record ID)
In the combo box's AfterUpdate event, the form is requeried, with
something like:
Me.Requery
The form is based on a query that points to the form's combo box as a
criterion for the record ID, something like:
Forms!YourForm!cboYourComboBox
The record ID selected in the combo box is used as the criterion in the
query that serves as a source for the form.
 
Thank you very much -- I redesigned things the way you said and it
works perfectly!!

Yee Hah!!
 
Back
Top