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

Getting rid of the "You are about to append 1 row(2)" 1

Status
Not open for further replies.

Larshg

Programmer
Mar 1, 2001
187
DK
I am adding a row to a table and getting to notifikations
1.
"You are about to append 1 row(2)"
2.
"Microsoft Access can't append all the record in the append query"

Here is the command that should add a record to the table
DoCmd.RunSQL "Insert into Historik values(3,1,'correct',1,'HWH',Now())"


 
Just before add:
Docmd.SetWarnings False

And just after
Docmd.SetWarnings True

If you have error handling toss that true one in again on its exit.
Gord
ghubbell@total.net
 
Woops! Sorry, didn't see that last part (forgot my specs again)...
Look at the results of this similar query in a datasheet view of a real query and see if the data and data types agree with where you are trying to insert them. Check also that your table is prepared to accept (possible duplicates?)... And disregard that last post till you have this going first. Sorry again, slightly blind, Gord
ghubbell@total.net
 
An additional chirp from the gallery: Don't do any code procedure without error trapping and be sure to have "DoCmd.SetWarnings True" in the Exit label. If you have an error break the code and don't have this in place you can operate for quite a while without realizing that your warnings no longer prompt to save or think about deletions.
 
2 cents to add on to Quehay's message:
This is from the Microsoft help file on the SetWarnings method:

"If you turn the display of system messages off in Visual Basic, you must turn it back on, or it will remain off, even if the user presses CTRL+BREAK or Visual Basic encounters a breakpoint. You may want to create a macro that turns the display of system messages on and then assign that macro to a key combination or a custom menu command. You could then use the key combination or menu command to turn the display of system messages on if it has been turned off in Visual Basic."

Personally, if it's just an issue of an append query, I would replace the code suggested above with the following. It limits the effects if there's a problem to just append queries:

--- Begin Code ---
dim bolUsersCurrentOption as boolean

' Note: You definitely want to get the user's
' current setting and set it back to that setting
' afterwards, instead of just setting to true afterwards.
' Speaking as somebody who has it set to False, I wouldn't
' appreciate an Access program setting it to True every
' time I clicked a button..

bolUsersCurrentOption = _
Application.GetOption ("Confirm Action Queries")

Application.SetOption "Confirm Action Queries", True

run action query here

Application.SetOption _
"Confirm Action Queries", bolUsersCurrentOption
--- End Code ---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top