Suppressing Insert/Update Warning

  • Thread starter Thread starter cbchhaya
  • Start date Start date
C

cbchhaya

Guest
I have a form frmTables for table TableA where I enter some data in field 'Val' and it leads to either an insertion of a new row in TableB - if the related row does not exist - or of updation of an existing row in TableB, depending upon some crierion.

I achieve this by using DoCmd.RunSQL from the Val_AfterUpdate method from frmTables. However, when I insert or enter something through RunSQL, it pops up annoying warning that I am about to insert (or update) rows in TableB.

How can I suppress this warning?

Thanks in advance

Regards

-Chiradeep
 
Before running the Docmd.runsql insert Docmd.Setwarnings False

You should then insert Docmd.Setwarnings True after your proceedure.
 
Thanks a lot

Hey,

Thanks a lot.. It works..

Cheers!!

-CBC
 
or you can use CurrentDb.Execute <strSQL> instead. this is tricky though because it will silently pass incorrect values unless you have some validation built in.

using DoCmd.SetWarnings opens you up to a program fault that takes away all your warnings if you forget to set it back to "True."
 
This is such a common (and not urgent) question that you should really learn to search before posting.
 

Users who are viewing this thread

Back
Top Bottom