3075 Syntax Error

  • Thread starter Thread starter Moulder
  • Start date Start date
M

Moulder

Guest
Below is the code that concatenates a pathway ('c:\asset_capture\images\) and a column value (c:\asset_capture\images\)to populate another column ([Carriageway].[Hotlink])


------------------------------------------------------------

Function Update_Image()

For Each tbl In CurrentDb.TableDefs

If tbl.Name = "Carriageway" Then

strsql1 = "[" & tbl.Name & "]" & ".[hotlink]"
strsql2 = "[" & tbl.Name & "]" & ".[position]"

'**** THE LINE BELOW WORKS****

'CurrentDb.Execute "UPDATE Carriageway SET [Carriageway].[Hotlink] = 'c:\asset_capture\images\' & [carriageway].[position]"

'**** THE LINE DOESN'T WORK WHEN STRING VALUE REPLACES COLUMN****

CurrentDb.Execute "UPDATE Carriageway SET [Carriageway].[Hotlink] = 'c:\asset_capture\images\'" & strsql2


End If

Next

End Function

--------------------------------------------------------


The module works perfectly when the column value is hardcoded as [carriageway].[position] but when a string is replaced as strsql2 then the error message "Run Time Error 3075 Syntax Error (Missing Operator) in Query Expression" is generated.

Any ideas gratefully received what seems a simple problem that is causing significant swearing and hair loss.

Thanks

Paul
 
Rather than trying to execute the two statements, when trying to debug just debug.print them or MsgBox them together and see what is different.

It should be readily apparent what is going wrong.
 

Users who are viewing this thread

Back
Top Bottom