Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Broken Query help

Status
Not open for further replies.

efiftythree

IS-IT--Management
Jan 13, 2006
27
US
I have a query that is breaking and I believe it is because of the data that is going into it. The query picks up info from a text box called txtUser which contains a name formated like: "Doe, John" (remove the "). I assume the , is killing the query. If so, how do I fix that?

Code:
Dim strUsersSQL As String

    strUsersSQL = "UPDATE tblUsers " & _
    "SET tblUsers.inuse = 1 " & _
    "WHERE (((tblUsers.user)=[Forms]![Main]![txtUser]))"

DoCmd.RunSQL strUsersSQL

 
Perhaps this ?
strUsersSQL = "UPDATE tblUsers " & _
"SET tblUsers.inuse = 1 " & _
"WHERE tblUsers.user=[tt]'"[/tt] & [Forms]![Main]![txtUser] & [tt]"'"[/tt]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for your response PHV. I tried to use your suggestion but I still had the same troubles. I did, however, realize that I can use the ID field from the users table instead of the actual user name which basically took the Doe, John and its comma out of the mix completely.

Thanks again for your response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top