Form: Event Procedure & Macro from same button ?

unc2plo

Board Regular
Joined
Mar 18, 2002
Messages
148
I have a button on a form with a DLookup that checks the value in a text box against the value of a field in a static table. It gives you a message box that tells you whether the value is correct or not.

I would like to have the same button kick off a macro that would record the data from the text box into a table as well. I wrote the append query that will record the value into a table, but can't figure out how to make the button do both things with only 1 click.

Is that possible?

Thanks,
David
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Assuming that the DLOOKUP is already in the Click event of the button, you could add this line to the code:
DoCmd.RunMacro "YourMacroNameHere"

Denis
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,195
Members
449,072
Latest member
DW Draft

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