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

"data mismatch type in criteria expression error" 1

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi Guys,

Can anyone see why the first line of this code would produce a "data mismatch type in criteria expression" error message.

Dim varx As Variant

varx = DCount("*", "[tblQuery]", "[EnQuiryId]='" & Me!Text3 & "'")

CurrentDb.Execute "UPDATE [tblQuery] SET [RecordId]=" & varx & " WHERE EnQuiryId='" & Me!Text3 & "' AND [RecordId] = 0"

I copied it from somewhere else where it works fine, all the fields are numbers. I cant get to the second line to see if that works. :)

Thanks in advance.
 
all the fields are numbers
Get rid of the single quotes ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PH,

You where right about the quotes and some in the second line too. I'm having problems as to where to fire this code from but it is working.

Dim varx As Variant

varx = DCount("*", "[tblQuery]", "[EnQuiryId]=" & Me!Text3 & "")

CurrentDb.Execute "UPDATE [tblQuery] SET [RecordId]=" & varx & " WHERE EnQuiryId=" & Me!Text3 & " AND [RecordId] = 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top