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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL insert without user prompt? 1

Status
Not open for further replies.

NXMold

Technical User
Jul 22, 2008
104
I am using some code to add a record to a table, but it pops up with a warning about appending 1 row... I don't want the user to see that and have the option to cancel. Can I surpress this message?

strSQL = "INSERT INTO UserTable ([NetworkName], [WorkstationID], [DisplayName]) VALUES ('" & NetworkUserName & "', '" & Environ("COMPUTERNAME") & "', '*" & NetworkUserName & "*')"

DoCmd.RunSQL strSQL
 
Code:
strSQL = "INSERT INTO UserTable ([NetworkName], [WorkstationID], [DisplayName]) VALUES ('" & NetworkUserName & "', '" & Environ("COMPUTERNAME") & "', '*" & NetworkUserName & "*')"

DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True

Joe Schwarz
Custom Software Developer
 
You can use Execute.

Code:
Set db=CurrentDB

db.Execute strSQL, dbFailOnErrror

msgbox "Inserted records: " & db.RecordsAffected
 
Thanks guys! I'm having a tough time finding syntax references in the help files for update queries, thats my next task.

I want to update the UserTable with a status (login at xx:xx, closed, idle for XX min, etc) from a function. Does anyone have a link to some syntax documentation? This sql stuff is still voodoo to me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top