Confirmation Message - UPDATE table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Al

When trying to update a record in VB codes using "UPDATE tablename…" command, Access2000 pops up a confirmation window for the changes. Is it possible to avoid the confirmation window? This does not happen in Access97

Although this feature can be turned off in the Tool/Option menu, this will apply to all Access databases/apps and need to be done on each machine. Can this be done using VB codes

Many thanks
 
I believe you're asking for the DoCmd.SetWarnings {True | False} statement.

Be *very careful* using this! When you turn it off, make sure on the EXIT
SUB/FUNCTION you turn it back on!

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
kev said:
Hi All

When trying to update a record in VB codes using "UPDATE tablename."
command, Access2000 pops up a confirmation window for the changes. Is it
possible to avoid the confirmation window? This does not happen in Access97.
Although this feature can be turned off in the Tool/Option menu, this will
apply to all Access databases/apps and need to be done on each machine. Can
this be done using VB codes?
 
Although this feature can be turned off in the Tool/Option menu, this
will apply to all Access databases/apps and need to be done on each
machine. Can this be done using VB codes?

As Rob says, using SetWarnings is not a good idea.

The VBA way is to use the .Execute method of the DAO.Database object, which
also gives you the option of handling errors properly:

' simple command
strSQL = "INSERT INTO MyTable (""Eric"", ""The Red"");"

' handle errors internally
On Error Resume Next

' run the command, note the FailOnError parameter
CurrentDB().Execute strSQL, dbFailOnError

' and see if it worked
If Err.Number <> 0 Then
' Bad luck
MsgBox "INSERT failed.. sorry!"

Else
' hooray
MsgBox "We got Eric the Red!!"

End If

Hope that helps


Tim F
 
Back
Top