Stop a variable from being given a new value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a statement with a variable (SiteNum) which in the real version of
the code will be a changable value depending on the txtBox in my form. For
the code test i simply set the variable to a value Te003. I then need to use
this value in an SQL statement as it refers to a column in a table. The
column consists of tick boxes which can be set to an on state but every time
i try to get the code to do this i assume it is just re-assigning the value
of 1 to my variable.
here is some of the code
Dim SiteNum As String

SiteNum = Te003
DoCmd.RunSQL ("UPDATE tblDates SET SiteNum = 1 ")
everytime it runs i can only assume instead of going to column Te003
represented by SiteNum it re-assigns the value 1 to siteNum.

Thanks in advance
 
I'm confused what you are trying to do, but does this solve the problem?
SiteNum = "Te003"
DoCmd.RunSQL ("UPDATE tblDates SET " & SiteNum & " = 1 ")
-LW
 
Back
Top