Double clicking Query list box results

Phonik

Registered User.
Local time
Today, 22:42
Joined
Sep 22, 2006
Messages
111
Hi,

Does anyone know how I can set up the following?

I have a form with a list box in it which is populated by the data from a query.
What I would like is that when a user clicks on one line of data so that the line goes black and the text goes white, I would like the code that when double clicked, will take you to a form with the record displaying the same data as the one that was in the list box.

E.g. The list box would be a work queue of outstanding post items to action and when a record is double clicked on, it takes you to another form but shows all of the data for that record as opposed to just the data in the list box query result.

Many thanks
 
First, make sure the first column (visible or not) in your listbox is the primary key of the record. Then, on the DoubleClick event of the listbox, you can use the following:

Docmd.OpenForm "frmYourForm", , , "[PrimaryKeyField] = " & me.lstBox

Just make sure to add the name of your form, the name of your primary key, and the name of your listbox.
 
Thanks

Cheers for that! Fantastic mate!

Regards,

Gareth
 

Users who are viewing this thread

Back
Top Bottom