Hadi
Hadi

Reputation: 39

Get Error 3075 Data type mismatch in criteria expression

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

Upvotes: 0

Views: 59

Answers (2)

Gustav
Gustav

Reputation: 55831

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 & "'"

Upvotes: 2

Herminne
Herminne

Reputation: 81

Try Dim strCriteria as String

dim task As String

Upvotes: 0

Related Questions