0
votes

i get

Error 3075 Data type mismatch in criteria expression

but i no able left it

what is the problem???

but DateCutting is Integer Type

Dim strCriteria, task As String
strCriteria = "([DateCutting]>= #'" & Me.txtfrom & "'# And [DateCutting]<=#'" & Me.txtto & "')#"
task = "select * from Cutting where [DateCutting]>= '" & strCriteria & "'"

DoCmd.ApplyFilter task
2
on which line does the error occur? - QHarr
on DoCmd.ApplyFilter task (but DateCutting is Integer Type) - Hadi

2 Answers

2
votes

Change DateCutting to DateTime and adjust your criteria:

Dim strCriteria As String

strCriteria = "[DateCutting] >= #" & Format(Me.txtfrom, "yyyy\/mm\/dd") & "# And [DateCutting] <= #" & Format(Me.txtto, "yyyy\/mm\/dd") & "#"

DoCmd.ApplyFilter strCriteria

To find a number:

strCriteria = "[Number] = " & Me.txtNumber & ""

as text:

strCriteria = "[TextNumber] = '" & Me.txtNumber & "'"
0
votes

Try Dim strCriteria as String

dim task As String