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

Bypassing the append message 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am using the subroutine below, which loads at start-up. The routine takes the User Name Date and TIme and appends this to a UserHistory Table. I would like to be able to do this without a message box coming up on the users computer telling them that a row is going to be appended. The database is run on a large number of computers, and it would be practically impossible to physically set each one up not to display the Append box. Is there any way I can make this diappear? Thanks!<br><br>Private Sub Form_Load()<br>Dim strSQL As String<br>Dim strUserName As String<br><br>'This will get the user name<br>strUserName = Environ(&quot;USERNAME&quot;)<br>'----------------------------<br>strSQL = &quot;INSERT INTO UserHistory (UserName,UserDate,UserTime) VALUES ('&quot; & strUserName & &quot;','&quot; & Date & &quot;','&quot; & Time() & &quot;')&quot;<br>DoCmd.RunSQL strSQL<br>End Sub <p>John Vogel<br><a href=mailto:johnvogel@computerwiz.net>johnvogel@computerwiz.net</a><br><a href= Home Page</a><br>Check out
 
Probably not what you want John but.<br>---------------------------<br>Private Sub Form_Load()<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim db As Database, rst As Recordset<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim strSQL As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim strUserName As String<br><br>&nbsp;&nbsp;&nbsp;&nbsp;'This will get the user name<br>&nbsp;&nbsp;&nbsp;&nbsp;strUserName = Environ(&quot;USERNAME&quot;)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Set db = CurrentDb<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rst = db.OpenRecordset(&quot;UserHistory&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.AddNew<br>&nbsp;&nbsp;&nbsp;&nbsp;rst!UserName = &quot; & strUserName & &quot; ' &lt;&nbsp;&nbsp;Not sure I got this right single quotes etc.<br>&nbsp;&nbsp;&nbsp;&nbsp;rst!UserDate = &quot;'&quot; & Format(Now, &quot;mm/dd/yy&quot;) & &quot;'&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;rst!UserTime = &quot;'&quot; & Format(Now, &quot;hh:nn&quot;) & &quot;'&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.Update<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;db.Close<br>End Sub<br>--------------------<br>I don't know why when ever you run a Docmd.RunSQL Access has to stick its nose into what would otherwise would be very clean compact code. By prompting &quot;Are You Sure?&quot;<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Thank you Doug. I am not sure why it never occured to me to use ADO to bypass the message. I guess I haven't been &quot;playing&quot; with ASP long enough to think that way :) <br>In case you are wondering, the correct code is below, and works poifectly :)<br><br>Private Sub Form_Load()<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim db As Database, rst As Recordset<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim strSQL As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim strUserName As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Set strUserName = Environ(&quot;USERNAME&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;Set db = CurrentDb<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rst = db.OpenRecordset(&quot;UserHistory&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.AddNew<br>&nbsp;&nbsp;&nbsp;&nbsp;rst!UserName = strUserName<br>&nbsp;&nbsp;&nbsp;&nbsp;rst!UserDate = Format(Now, &quot;mm/dd/yy&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;rst!UserTime = Format(Now, &quot;hh:mm:ss&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.Update<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;db.Close<br>End Sub<br><br>Thanks again!<br> <p>John Vogel<br><a href=mailto:johnvogel@computerwiz.net>johnvogel@computerwiz.net</a><br><a href= Home Page</a><br>Check out
 
I usually eliminate the &quot;Append/update/delete query Notifications&quot; with:<br><br>Docmd.Setwarnings FALSE<br>DoCmd.RunSQL strSQL<br>Docmd.Setwarnings TRUE<br><br><br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top