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

Turn off record insert into table warnings Access 2003 1

Status
Not open for further replies.

vamoose

Programmer
Oct 16, 2005
320
MX
I am running a VBA query which inserts 1 record into a table. I am getting the message box warning:

You are about to append 1 row(s).

I have tried using: DoCmd.SetWarnings False

But the message still appears. Is there another command I can use to disable this warning ? Thank you.
 
The insert VBA code is working fine, I just want to disable the message box alerting the user of the table being updated. The insert code is used to log the error into a table for future actions. Thank you.

Err_Command228_Click
MsgBox Err.Description
DoCmd.SetWarnings False

DoCmd.RunSQL "Insert Into tbl_password (Incorrect,PDate) values ('" & [Material] & "','" & [PDate] & "');"
rs.Close: conn.Close: Set rs = Nothing: Set conn = Nothing

End Sub
 
You can use execute:

Code:
CurrentDB.Execute "Insert Into tbl_password (Incorrect,PDate) values ('" & [Material] & "','" & [PDate] & "');", dbFailOnError
rs.Close: conn.Close: Set rs = Nothing: Set conn = Nothing

However, if PDate is a date, you have the wrong delimiter.
 
How are ya vamoose . . .

I"m a little late, but to permanently turn off [blue]action query messages (no code necessary):[/blue]

From the Db window its [blue]MenuBar[/blue] - [blue]Tools[/blue] - [blue]Options[/blue] - [blue]Edit/Find Tab[/blue] - [blue]Confirm Section[/blue] - [purple]make sure Action queries is unchecked.[/purple]

[blue]Your thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I would not generally turn of the warning under tools, because I like to have the warning there when I am setting things up - it is easy to mess up a where statement, for example.
 
Howdy Remou . . .

I've never needed the warnings and turn them off by default! As far as my queries go, in testing they either work or they don't. A message to tell me what I already see is not needed . . . at least for me.

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Aceman and Remou raise interesting points here, turning off at menu level is largely circumstancial.

I have some apps where it is easy to see if a query has worked by lack of, or presence of, an output.

However, some of my apps have detailed criteria and a visual / manual check that 20394 records have been updated rather than 19038 would be tedious.

As ever, it's a case of stubbies or tinnies / swings and roundabouts, 6 of 1 or half a dozen of the other.

Just thought I'd mention it as lots of newbie people read these posts and I wouldn't want either to think there is a right or wrong way to do this.

PS. There's always the .recordsaffected property too. at least, i think that's what it's called

JB
 
Howdy JBinQLD . . .

TheAceMan1 said:
[blue]Anything complex enough should receive thorough enough testing, even if it appears flawless![/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top