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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,053
Messages
5,835,149
Members
430,342
Latest member
Sailingexcel

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
Top