469,097 Members | 1,599 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,097 developers. It's quick & easy.

Editing field in filtered SQL query - RunTime Error 3464

In the following code I am attempting to open a query and edit the
lastMaintenance field for a particular equipment number. My code looks like
this:

Dim db As Database
Dim rs As Recordset
Dim SQL As String

Set db = DBEngine.Workspaces(0).Databases(0)
Set rs = db.OpenRecordset("SELECT * From qryPlannedMaintenance WHERE
[EquipmentNumber] = '" & EquipmentNumber & "';")
rs.MoveFirst
rs.Edit
rs![LastMaintenance] = Date
rs.Update
rs.Close

Set rs = Nothing
Set db = Nothing

At the moment I am getting this run time error on the Set rs line:
Run-time error 3464. Data type mismatch in criteria expression.

Any suggestions?

Thanks in advance
Nov 13 '05 #1
1 4739
Solved
It was the ' 's

thanks

"Will" <Wi*****************@hotmail.com> wrote in message
news:39*************@individual.net...
In the following code I am attempting to open a query and edit the
lastMaintenance field for a particular equipment number. My code looks like this:

Dim db As Database
Dim rs As Recordset
Dim SQL As String

Set db = DBEngine.Workspaces(0).Databases(0)
Set rs = db.OpenRecordset("SELECT * From qryPlannedMaintenance WHERE [EquipmentNumber] = '" & EquipmentNumber & "';")
rs.MoveFirst
rs.Edit
rs![LastMaintenance] = Date
rs.Update
rs.Close

Set rs = Nothing
Set db = Nothing

At the moment I am getting this run time error on the Set rs line:
Run-time error 3464. Data type mismatch in criteria expression.

Any suggestions?

Thanks in advance

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by John young | last post: by
1 post views Thread by dan.cawthorne | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.