Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List box

Status
Not open for further replies.

pra4par

IS-IT--Management
Sep 10, 2003
23
US
Here is the situation:

I have a form that shows one record at a time. Each record is an entry in a table. The table is called Trips. On the form that shows details about each "trip", I want to add a list box that lists out each traveler and their personal info. I dont want it to be a subform because I want to be able to double click on any of the travelers and go to another form where I can edit that travelers info. Each trip has a unique ID and the traveler is linked to the trip by that field. Any suggestions on how to do that. I am assuming I just have to base the list box on a query, but I am having trouble making a query to select all travelers that mach a single trip ID. I can get the query to poll all travelers with a trip ID that matches any ID in the Trips table. I hope this makes sense.

Thanks so much
 
Hi
How about:
Code:
Private Sub Form_Current()
Me!lstTraveller.RowSource = "SELECT [Travellers].[TravellerID], [Travellers].[Traveller] " _
    & "FROM Travellers WHERE ((([Travellers].[TripID])=[Forms]![Trips]![TripID]))"

End Sub

Private Sub lstTraveller_DblClick(Cancel As Integer)
DoCmd.OpenForm "Travellers", , , "TravellerID=" & Me!lstTraveller.Column(0)
End Sub

(This type of thing works just as well with subforms, because that is what I use for a Libraries / Journals setup)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top