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

Find recordset using date field problem

Status
Not open for further replies.

millrat

Technical User
Joined
Dec 23, 2003
Messages
98
Location
US
Hi all,
I am trying to find a record on my form using the code below but I keep getting errors. Depending on how I move the quotes etc around I get different errors, sometimes data type mismatch, other times syntax error, missing operator. Now I'm confused, is it the syntax or the datatype?

[dtmDate] is the field datatype Date
Me.cboDate is textbox control source [dtmDate]

Dim rst As DAO.Recordset
Set rst = Forms!frmLog.Recordset.Clone
rst.FindFirst "[dtmDate]= '" & Me.cboDate & "'"
If Not rst.EOF Then
Forms!frmLog.Bookmark = rst.Bookmark
End If
End If

Any help appreciated
millrat
 
Hi
Dates need #.
[tt] rst.FindFirst "[dtmDate]= #" & Me.cboDate & "#"[/tt]
 
Remou is correct, but sometimes you'll need to take it a step further - that is if you're on other date settings than US - have a look at International Dates in Access for more info.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top