Error 3464 with an UPDATE query statement

chacal

Registered User.
Local time
Today, 04:27
Joined
Jun 1, 2005
Messages
40
Hi everyone,

I'm trying to execute an update query by using the DoCmd.RunSQL. Here is my statement:

Code:
 DoCmd.RunSQL "UPDATE T_Facturation SET TotalQuantiteDiesel = TotalQuantiteDiesel + " & Me.TxtQuantiteDiesel.Value & ", " & _
        "TotalInst = TotalInst + " & Me.TxtInst.Value & ", TotalDemo = TotalDemo + " & Me.TxtDemo.Value & ", " & _
        "TotalCoutDiesel = TotalCoutDiesel + " & Me.TxtCoutDiesel.Value & ", TotalLocationHQ = TotalLocationHQ + " & Me.TxtLocationHQ.Value & ", " & _
        "TotalTempsHQ = TotalTempsHQ + " & Me.TxtTempHQ.Value & ", TotalLocation = TotalLocation + " & Me.TxtLocation.Value & ", " & _
        "TotalTransfo = TotalTransfo + " & Me.TxtTransfo.Value & ", TotalAutreDep = TotalAutreDep + " & Me.TxtAutresDep.Value & ", " & _
        "TotalCable = TotalCable + " & Me.TxtCable.Value & ", TotalElectricien = TotalElectricien + " & Me.TxtElectricien.Value & ", " & _
        "TotalTempExt = TotalTempExt + " & Me.TxtTempsExt.Value & ", " & _
        "TotalTransportGeneratrice = TotalTransportGeneratrice + " & Me.TxtTransportGeneratrice.Value & ", " & _
        "TotalTransportTransfo = TotalTransportTransfo + " & Me.TxtTransportTransfo.Value & " WHERE NoAutoInstallation = '" & Me.TxtNoAutoInstallation.Value & "';"

My problem is that when I execute this code, I got the error:
Run-time error '3464': Data type mismatch in criteria expression.

I tried to change my query statement, but I cannot find my error. I'm using Access 2003. I'm really lost.

Can someone help me please!

Thanks a lot
 
The error exactly tells you what's wrong.
You're using one or more incorrect data types in one or more criteria.

I'd start by taking out the suffices Value, you don't need them.
Next, check the datatype for each table column.

If it's a text string, use '" & Me.YourTextField & "'
If it's a numeric string, use " & Me.YourTextField & "

RV2
 
All right, I fixed it!
The problem were the where clause.
Thanks anyway :)
 

Users who are viewing this thread

Back
Top Bottom