Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

help with an sql string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jln - 06 Mar 2008 16:57 GMT
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") & "';"
Douglas J. Steele - 06 Mar 2008 17:05 GMT
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"

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> What im trying to is when a person logs in it updates the loged_in column
> for
[quoted text clipped - 3 lines]
> Analyst.
> GID ='" & Environ("username") & "';"
J_Goddard - 06 Mar 2008 17:09 GMT
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") & "';"

Signature

John Goddard
Ottawa, ON Canada
jrgoddard at cyberus dot ca

jln - 06 Mar 2008 17:18 GMT
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") & "';"

>Hi -
>
[quoted text clipped - 12 lines]
>>strSQL = strSQL & "UPDATE Analyst SET Analyst.[Loged_IN]" & "Where Analyst.
>>GID ='" & Environ("username") & "';"
jln - 06 Mar 2008 17:21 GMT
OK GOT IT

>Ok i see what your saying so i changed the statement to this.
>
[quoted text clipped - 6 lines]
>>>strSQL = strSQL & "UPDATE Analyst SET Analyst.[Loged_IN]" & "Where Analyst.
>>>GID ='" & Environ("username") & "';"
Allan Smulling - 06 Mar 2008 17:16 GMT
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.

> 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") & "';"
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.