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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recordset based on two variables

Status
Not open for further replies.

BradCollins

Technical User
Sep 2, 2003
116
AU

I have created the code as below, and this works fine. However how do I change this so that it looks at two fields to select the correct record.
I need it find a record where cmbTrailerSelect = fldVehicleTrailer (this bit works), but also where txtDateSelect = fldDate

Any help is most appreciated. Thanks


Private Sub cmbTrailerSelect_AfterUpdate()

Dim rst As Recordset
Dim strSearch As String

Set rst = Me.RecordsetClone
strSearch = Str(Me!cmbTrailerSelect)
rst.FindFirst "fldVehicleTrailer = " & strSearch
If rst.NoMatch Then
msgbox "No record with the selected criteria has been found. Please try again.", vbOKOnly, "Westoil Petroleum Pty Ltd"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close

End Sub
 
In case you are still interested:

[tt]strSearch = Str(Me!cmbTrailerSelect) & " And fldDate =#" _
& Format(txtDateSelect, "yyyy/mm/dd") & "#"
rst.FindFirst "fldVehicleTrailer = " & strSearch[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top