By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Want an "Alert Message"before the operation

P: 13
Hi, I wrote a RunSQL Macros to drop a table and used that on a button.
How should i add an "Alert" to it i.e; i should get an "Alert Message" as soon as i click that button.
May 8 '07 #1
Share this Question
Share on Google+
4 Replies


Denburt
Expert 100+
P: 1,356
You should get a prompt automatically anytime you drop a table. What does the SQl statement look like and how did you create this "Macro"?
May 8 '07 #2

JConsulting
Expert 100+
P: 603
Hi, I wrote a RunSQL Macros to drop a table and used that on a button.
How should i add an "Alert" to it i.e; i should get an "Alert Message" as soon as i click that button.
IF you have button code, add this.

Expand|Select|Wrap|Line Numbers
  1.  
  2. If MsgBox("You're about to delete a table, are you sure?", vbYesNo) = vbNo Then exit sub
  3. else
  4. 'run your macro here
  5. end if
  6.  
May 8 '07 #3

P: 13
ssq
Macro: Action - RunSQL
Statement - drop table 'table name'
(or)
Action - DeleteObject
Object Type - Table
Object Name - Select the Table
But JConsulting, how should i call that Macro in the Code, button is not coded i am calling this macro in button properties 'On Click'
May 9 '07 #4

Denburt
Expert 100+
P: 1,356
But JConsulting, how should i call that Macro in the Code, button is not coded i am calling this macro in button properties 'On Click'
Change the onclick event to [Event Procedure] then click the button to the right of that field. You can run everything from code as per JConsulting's suggestion.


Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. If MsgBox("You're about to delete a table, are you sure?", vbYesNo) = vbNo Then
  3.  exit sub
  4. else
  5. docmd.RunMacro("YourMacroName")
  6. end if
You could actually convert that macro into code as well. Let's see I haven't used that tool in so long...

Macro Conversion
May 9 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.