Full Version: How do I remove Notification Message in 2007 Version: 2007 (12.
UtterAccess Forums > Microsoft® Access > Access Forms
diggerdidoodar
I have added a button to a form thats starts by deleteting data from a table & the appends data to the same table. I want to remove the warning messages when running the action, in 2003 I would go into VBA & add DoCmd.warnings False but now I get this macro builder thing instead.
Is there a way to switch from the macro builder to default VBA like 2003.
it of a Newey to 2007.
Cheers
Doug Steele
There was no need to post this to two forums.
resumably you're using the DoCmd.RunSQL method to run the queries.
Use the Execute method instead. Depending on what you're doing, it's either
CurrentDb.Execute "sql string", dbFailOnError
or
CurrentDb.QueryDefs("NameOfQuery").Execute dbFailOnError
The dbFailOnError parameter is optional, but including it means that a trappable error will be raised if something goes wrong running the query, and the error message is sometimes useful in tracking down the problem.
diggerdidoodar
Thank you for your reply, although i'm more confused unfortunatly.
Is it possible to amend a command button with VBA & not this new macro builder thing in 2007. Basically I want to do this in the event proceeddure of a command button but in 2007.
Private Sub Run_Delete_Results_Click()
On Error GoTo Err_Run_Delete_Results_Click
'MsgBox ("Do Not Continue if isql programs have not ran,vbOKCancel")

DoCmd.SetWarnings False
Dim stDocName As String
'Stage1-1
stDocName = "Query_Delete_Results_Table"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
Exit_Run_Delete_Results_Click:
Exit Sub
Err_Run_Delete_Results_Click:
MsgBox Err.Description
Resume Exit_Run_Delete_Results_Click
Doug Steele
You can use event procedures in Access 2007: you just can't use the wizard to build them.
!--c1-->
CODE
Private Sub Run_Delete_Results_Click()
On Error GoTo Err_Run_Delete_Results_Click
Dim stDocName As String
  
'Stage1-1
  stDocName = "Query_Delete_Results_Table"
  CurrentDb.QueryDefs(stDocName), dbFailOnError
  
Exit_Run_Delete_Results_Click:
  Exit Sub
  
Err_Run_Delete_Results_Click:
  MsgBox Err.Description
  Resume Exit_Run_Delete_Results_Click
  
End Sub

Realistically, OpenQuery wasn't a good way to invoke an action query in the first place.
diggerdidoodar
Is it possible though to turn off the warning message in the embedded macro???
ie
Action Arguments
Openquery Query_tbl_Pref+NonPref_Delete, Datasheet, Edit
Is when I change the click properties of the button to Event Proceedure there is no code??.
My Appologies for my being thick.
PaulBrand
hi,
know what you're getting at I think, ACC2007 fires macro's by default. If you convert them to VBA (can't remember how now) you will be given the option to change the defaults.
The wizards do this as well.
HTH
Paul
diggerdidoodar
Anyone know how to convert macros to vba by default??
Doug Steele
Have you tried the SetWarnings action?
JVanKirk
Digger, I wish I had 2007 to help you out, I know what you mean. Doug's last post, using the SetWarning in the Macro builder would atleast get your messages turned off probably, but still doesn't help you get set so you go into VBA rather than the Macro builder. When you view the properties of a control in 2007, do you still have the option in the OnClick event to select [Event Procedure]? If so, when you click on the build button to the right of that, is this when it is going to the Macro Builder rather than the VBA code?
diggerdidoodar
SetWarnings doesnt appear in the list of macro actions in the Embedded macro.
Jason, yes it goes to the VBA but there is no code in there just the start & end info.
I'm so confused.
Doug Steele
I gave you the VBA you need: just copy it into the stub.
Regarding the list of macro actions, have you clicked on the Show All Actions? (See the Access 2007 FAQ for details) (Note that I don't have Access 2007 on this machine, so I don't know for certain that that will solve the problem)
diggerdidoodar
Cheers Doug, sorted ,told you I was a balloon.
JVanKirk
Uhhh, OK, I thought you weren't even getting the VBA window open with that..yes, as Doug said, you have to enter your code, Access has done it's part by putting the Sub start and End in for you. Glad you(er Doug) got it working sad.gif
Good luck with the rest of your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.