help with an sql string

  • Thread starter Thread starter jln via AccessMonster.com
  • Start date Start date
J

jln via AccessMonster.com

What im trying to is when a person logs in it updates the loged_in column for
that person. The code is running but notthing happens.

strSQL = strSQL & "UPDATE Analyst SET Analyst.[Loged_IN]" & "Where Analyst.
GID ='" & Environ("username") & "';"
 
To be honest, I'm surprised you don't get an error, because there are two
mistakes with the SQL.

1) You're not providing a value for Analyst.[Loged_IN] (if it's a yes/no
field, you need Analyst.[Loged_IN] = True)
2) You don't have a space in front of the keyword "Where"
 
Hi -

You said "the code is running but nothing happens...". How do you know the
code runs? It shouldn't, because it has an error in it. You have not set
Analyst.[Loged_IN] to a value. Do you have a db.execute strSQL
statement to execute the SQL?

What is in strSQL before you append UPDATE.... to it?

John

What im trying to is when a person logs in it updates the loged_in column for
that person. The code is running but notthing happens.

strSQL = strSQL & "UPDATE Analyst SET Analyst.[Loged_IN]" & "Where Analyst.
GID ='" & Environ("username") & "';"

--
John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

Message posted via AccessMonster.com
 
I think you may need to modify the the SET part of the statement. i.e.:

strSQL = "UPDATE Analyst SET <ColumnName> = '" & Analyst.[Loged_IN] & _
"' WHERE GID = '" & environ("username") & "'"

I'm not sure which are you column names but here's the SQL format for
updating:
UPDATE <TableName>
SET <ColumnName> = <Value>
WHERE <criteria>

Hope this helps.
 
Ok i see what your saying so i changed the statement to this.

CurrentDb.Execute "(UPDATE Analyst SET Analyst.[Loged_IN]= yes") & "Where
Analyst.GID ='" & Environ("username") & "';"

J_Goddard said:
Hi -

You said "the code is running but nothing happens...". How do you know the
code runs? It shouldn't, because it has an error in it. You have not set
Analyst.[Loged_IN] to a value. Do you have a db.execute strSQL
statement to execute the SQL?

What is in strSQL before you append UPDATE.... to it?

John
What im trying to is when a person logs in it updates the loged_in column for
that person. The code is running but notthing happens.

strSQL = strSQL & "UPDATE Analyst SET Analyst.[Loged_IN]" & "Where Analyst.
GID ='" & Environ("username") & "';"
 
Back
Top