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

Type Mismatch

Status
Not open for further replies.

JDU

Technical User
Dec 23, 2002
182
US
strSQL = "Select * from tblHns where Datediff('d'," & txtDate & ",[Date]) >=30"
Set rstHns = dbs.OpenRecordset(strSQL)

I get an error of type mismatch

The field Date is of type Date/Time and format of Short Date

The field txtDate is a textbox on a form with a format of Short Date.

Please help, Thanks.
 
Access usually needs some explicit specification about date fields entered as text fields. Try
Code:
strSQL = "Select * from tblHns where " & _
         "Datediff('d', [COLOR=red]#[/color]" & txtDate & "[COLOR=red]#[/color],[Date]) >=30"
 
Thanks, but I still get the same type mismatch error.
 
Figured out what my error was. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top