Go to specific record from a list box on another form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello there!

I have a list box on a separate form that lists tours for the day. Each tour
has a TourNumber (primary key), as well as some other general information of
the tour (name, how many people going, etc.) I have it so that when I double
click on one of the tours listed, (via a macro using OpenForm) it opens up
the form (hopefully to that specific record...kinda like "view details").
Unfortunately it opens to some random record instead of the particular record
I selected in the list box.

How do I make it go to the specific record I choose in the list box?
-Doug
 
Doug,

substituting your names, the syntax would be:
'assuming TourNumber is a numeric value
DoCmd.OpenForm "MyForm", , , "[TourNumber]=" & Me.MyListBox
otherwise,
DoCmd.OpenForm "MyForm", , , "[TourNumber]='" & Me.MyListBox & "'"

HTH,
Brian
 
WORKED GREAT! Thanks A Lot!

Brian Bastl said:
Doug,

substituting your names, the syntax would be:
'assuming TourNumber is a numeric value
DoCmd.OpenForm "MyForm", , , "[TourNumber]=" & Me.MyListBox
otherwise,
DoCmd.OpenForm "MyForm", , , "[TourNumber]='" & Me.MyListBox & "'"

HTH,
Brian

Doug Dickey said:
Hello there!

I have a list box on a separate form that lists tours for the day. Each tour
has a TourNumber (primary key), as well as some other general information of
the tour (name, how many people going, etc.) I have it so that when I double
click on one of the tours listed, (via a macro using OpenForm) it opens up
the form (hopefully to that specific record...kinda like "view details").
Unfortunately it opens to some random record instead of the particular record
I selected in the list box.

How do I make it go to the specific record I choose in the list box?
-Doug
 
Back
Top