Hadi
Hadi

Reputation: 39

Get Error 3464 Data type mismatch in criteria expression

i get Error 3464 Data type mismatch in criteria expression but i no able left it what is the problem???

Dim strsql As String
strsql = "select * from Shift where DFail Between " & txtVal1 & " and " & txtVal2
Me.RecordSource = strsql

Upvotes: 1

Views: 101

Answers (1)

Gustav
Gustav

Reputation: 55981

You miss the single-quotes:

strsql = "select * from Shift where DFail Between '" & txtVal1 & "' and '" & txtVal2 & "'"

Have in mind though, that text is sorted from left to right, like: 1, 12, 2, 20.

Upvotes: 1

Related Questions