Find a record with compound key

  • Thread starter Thread starter larpup
  • Start date Start date
L

larpup

I have a form that is sorted by
[CustomerName]&[OriginAirport]&[DestinationAirport]
Example ..
CustomerName&LAX&JFK
CustomerName&LAX&SAN
CustomerName&ORD&CLE

Can anyone enlighten me how to locate a record based upon the three
fields? Any info will be greatly appreciated.

Lar
 
I have a form that is sorted by
[CustomerName]&[OriginAirport]&[DestinationAirport]
Example ..
CustomerName&LAX&JFK
CustomerName&LAX&SAN
CustomerName&ORD&CLE

Can anyone enlighten me how to locate a record based upon the three
fields? Any info will be greatly appreciated.

Do you mean move your form to that record? If you've got a reference to DAO, you could do something like this

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone

rst.FindFirst "CustomerName='" & Me.ctlName & "' AND (AirportCode='" & Me.ctlAirport1 & "' OR AirportCode='" &
Me.ctlAirport2 & "'"

If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If

You'd have to change the Me.ctlxxx stuff to match your form, if you want to use controls on your form to fill the
criteria.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
Back
Top