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

G

Guest

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?
 
G

Guest

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?
 
G

Guest

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.
 

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

Top