SQL UPDATE String Issue

CharlesWhiteman

Registered User.
Local time
Today, 21:41
Joined
Feb 26, 2007
Messages
421
I keep getting "Data Type Mismatch" Error on this code. If I reference the txtbox directly Access always prompts me for the value. If I reference the value as a string I get the datatype mismatch error. Apart form that it works! Been trying to solve for a few hours so any advice greatfully received. Heres the code:

'Update Address Details To Primary Data
Dim varPK As String
varPK = Me.txtPrimaryDataID
Dim strSQLUpdate As String
Dim varAddress1 As String
varAddress1 = Me.txtAddress1
Dim varAddress2 As String
varAddress2 = Me.txtAddress2
Dim VarCity As String
VarCity = Me.txtCity
Dim varCounty As String
varCounty = Me.txtCounty
Dim varPostCode As String
varPostCode = Me.txtPostCode
strSQLUpdate = "UPDATE tblPrimaryData SET Address1 = '" & [varAddress1] & "', Address2 = '" & [varAddress2] & "',City = '" & [VarCity] & "', County = '" & [varCounty] & "', PostCode = '" & [varPostCode] & "' WHERE PrimaryDataID = '" & [varPK] & "';"
DoCmd.RunSQL strSQLUpdate
 
Hi,

What's the data type of PrimaryDataID in tblPrimaryData?

Simon B.
 

Users who are viewing this thread

Back
Top Bottom