Double click on a listbox and open a form to that specific record?

A

Angie

Hi,
I have a form with an unbound listbox (EventList), the listbox is getting
its data from a query. I want the user to double click on an item in the list
and have the "Event Information" form pop up displaying the specific record
from the listbox.
The criteria that it should be looking up is "EventID"(this textbox is
hidden) in the Event Information form. The listbox has 3 columns the first is
the EventID, but it is hidden.

Any help would be greatly appreciated.
 
F

fredg

Hi,
I have a form with an unbound listbox (EventList), the listbox is getting
its data from a query. I want the user to double click on an item in the list
and have the "Event Information" form pop up displaying the specific record
from the listbox.
The criteria that it should be looking up is "EventID"(this textbox is
hidden) in the Event Information form. The listbox has 3 columns the first is
the EventID, but it is hidden.

Any help would be greatly appreciated.

I take it [EventID] is a Number datatype, and that the first column
(hidden) is the bound column of the list box.

Code the list box Double-click event:

DoCmd.OpenForm "Event Information", , , "[EventID] = " &
Me![EventList]

Wouldn't a Combo box be more suitable than a List box for this?
 
A

Angie

I tried tried the code and it still doesn't work, the form does come up but
it seems to bring up a blank record.
Any other suggestions? I thought a list box would be the easiest, would a
combo box be more suitable?

Thanks.

fredg said:
Hi,
I have a form with an unbound listbox (EventList), the listbox is getting
its data from a query. I want the user to double click on an item in the list
and have the "Event Information" form pop up displaying the specific record
from the listbox.
The criteria that it should be looking up is "EventID"(this textbox is
hidden) in the Event Information form. The listbox has 3 columns the first is
the EventID, but it is hidden.

Any help would be greatly appreciated.

I take it [EventID] is a Number datatype, and that the first column
(hidden) is the bound column of the list box.

Code the list box Double-click event:

DoCmd.OpenForm "Event Information", , , "[EventID] = " &
Me![EventList]

Wouldn't a Combo box be more suitable than a List box for this?
 
A

Angie

Fredg,

Thanks for your help I figured out what was wrong, I had the bound column
set to 0 instead of 1.

fredg said:
Hi,
I have a form with an unbound listbox (EventList), the listbox is getting
its data from a query. I want the user to double click on an item in the list
and have the "Event Information" form pop up displaying the specific record
from the listbox.
The criteria that it should be looking up is "EventID"(this textbox is
hidden) in the Event Information form. The listbox has 3 columns the first is
the EventID, but it is hidden.

Any help would be greatly appreciated.

I take it [EventID] is a Number datatype, and that the first column
(hidden) is the bound column of the list box.

Code the list box Double-click event:

DoCmd.OpenForm "Event Information", , , "[EventID] = " &
Me![EventList]

Wouldn't a Combo box be more suitable than a List box for this?
 
F

fredg

I tried tried the code and it still doesn't work, the form does come up but
it seems to bring up a blank record.
Any other suggestions? I thought a list box would be the easiest, would a
combo box be more suitable?

Thanks.

fredg said:
Hi,
I have a form with an unbound listbox (EventList), the listbox is getting
its data from a query. I want the user to double click on an item in the list
and have the "Event Information" form pop up displaying the specific record
from the listbox.
The criteria that it should be looking up is "EventID"(this textbox is
hidden) in the Event Information form. The listbox has 3 columns the first is
the EventID, but it is hidden.

Any help would be greatly appreciated.

I take it [EventID] is a Number datatype, and that the first column
(hidden) is the bound column of the list box.

Code the list box Double-click event:

DoCmd.OpenForm "Event Information", , , "[EventID] = " &
Me![EventList]

Wouldn't a Combo box be more suitable than a List box for this?

Is [EventID] a Number datatype?
Did you place the 3 commas as I posted?
Is the Bound Column of the list box the [EventID] column?

Post your actual code so we can see what you have done.

A combo would probably be more suitable, especially if you have lot's
of records. The coding is the same.
 
Top