AUTOMATE the acknowledgement of a CONFIRMATION

Lyda_Faye

New Member
Joined
Feb 20, 2003
Messages
49
I have automated the process of importing an Excel spreadsheet into an Access database. The user will click a button on the switchboard in Access to begin the import. Before the spreadsheet data is actually transferred, I delete the records in the existing Access table by using a DOCMD.RunSql(Delete * from table) statement in the vba code behind the button. But, the message to confirm the records to be deleted always comes up.
Q: Is there anyway to automatically acknowledge this statement with a 'Yes" response so that the user does not have to answer it each time? Or...
Is there any other way to clear the exisiting data in the table? Idon't want the new records to append to the table and I want to keep the table structure intact.

The second part to this is if I use the confirmation statement to
"Delete Records Yes or No" is there a way to know what button was pressed? If the user pressed "no" then I want to know so I can bypass the import routine.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hullo. The first part is easy: If this is in a Macro, add SetWarnings=False at the head, and SetWarnings=True at the end. The same basic syntax will work in a Module.

The second part is equally easy: Set up an InputBox with vbYesNo as the option type. Then, use an If statement based on the InputBox checking for vbYes to continue, and vbNo to cancel.

HTH (y)

P
 
Upvote 0

Forum statistics

Threads
1,221,531
Messages
6,160,364
Members
451,642
Latest member
mirofa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top