Referring to variables

wjoc1

Registered User.
Local time
Today, 21:23
Joined
Jul 25, 2002
Messages
117
Hi, here is an update query I have in a section of VB code:

oldValue = oldCodeValue
'the new and possibly changed value
newValue = Me!Code.value
'the syntax for the update query that may have to run
updateCodesQuery = "UPDATE [NETWORK REFURBISHMENT-WORK_COMPLETED] SET [NETWORK REFURBISHMENT-WORK_COMPLETED].Code = newValue WHERE ((([NETWORK REFURBISHMENT-WORK_COMPLETED].Code)= oldValue))"
'If the two values differ i.e. the user has made changes then run the query
If Not (oldValue = newValue) Then
DoCmd.RunSQL updateCodesQuery
End If

This does not work because I am not refrring to the variables oldCodeValue and newValue correctly in the syntax. How do I reference them correctly??

Thanks,

Liam
 

Users who are viewing this thread

Back
Top Bottom