Help with code joining two criteria

R

Randy

Private Sub GetEIDDate_Click()

Access 2000. I'm trying to get this code to work by joining [EID] and
[Current_Date] below. I have two textboxes and a cmd button, hoefully will
send my form to the record with the two criteria selected.,Thanks...Randy

Dim lngLen As Long
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Current_Date] = #" & Format(Me![txtDate], "mm\/dd\/yyyy") &
"#" _
& "# And [Eid] = " & Str(Me![txtEID])
' Find the two records ([EID] and [Current_Date] that matches the control.
Me.Bookmark = rs.Bookmark
End Sub
 
V

Van T. Dinh

You got 2 hashes (##) after the explicit date value after the Strong
construction.

Try (if [EID] is Numeric)

rs.FindFirst "[Current_Date] = " & Format(Me![txtDate], "\#mm/dd/yyyy\#") &
_
" And [Eid] = " & Str(Me![txtEID])

If [EID] is a Text Field:

rs.FindFirst "[Current_Date] = " & Format(Me![txtDate], "\#mm/dd/yyyy\#") &
_
" And [Eid] = '" & Str(Me![txtEID]) & "'"
 
R

Randy

Thanks Van, that was it...Randy

Van T. Dinh said:
You got 2 hashes (##) after the explicit date value after the Strong
construction.

Try (if [EID] is Numeric)

rs.FindFirst "[Current_Date] = " & Format(Me![txtDate], "\#mm/dd/yyyy\#")
& _
" And [Eid] = " & Str(Me![txtEID])

If [EID] is a Text Field:

rs.FindFirst "[Current_Date] = " & Format(Me![txtDate], "\#mm/dd/yyyy\#")
& _
" And [Eid] = '" & Str(Me![txtEID]) & "'"

--
HTH
Van T. Dinh
MVP (Access)


Randy said:
Private Sub GetEIDDate_Click()

Access 2000. I'm trying to get this code to work by joining [EID] and
[Current_Date] below. I have two textboxes and a cmd button, hoefully
will send my form to the record with the two criteria
selected.,Thanks...Randy

Dim lngLen As Long
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Current_Date] = #" & Format(Me![txtDate], "mm\/dd\/yyyy")
& "#" _
& "# And [Eid] = " & Str(Me![txtEID])
' Find the two records ([EID] and [Current_Date] that matches the
control.
Me.Bookmark = rs.Bookmark
End Sub
 

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