Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro autoexec

Status
Not open for further replies.

100bure

IS-IT--Management
Feb 11, 2002
12
CH
Hi

Is it possible to change the condition of a Macro with VBA? I would like to append a field to a table with a function which is called from the autoexec macro. But this Function should be called only once.

thanks

bure
 
Hi 100bure,

How about converting you Autoexec Macro to a vb Function using the build in conversion (Tools, Options, Convert...). Then Make another Autoexec Macro which has just a runcode command to run the Function you just created. This was you can get more control over things. Then put an IF staement into the code you are trying to run only once. Make the IF statement perform a test on the contects of a table (eg DlookUp(...the entry in the table = a specific thing). If the contents do = this specific thing, make the code run an update query on the table so the contents become something different. This way, on first run, the table entry changes and the code will therefore never run again.

Its a bit of a lumpy solution bit I know it works. I've used it before with a Autoexec macro to keep on showing a form (which the user has to press OK or Cancel to Accept licence conditions). Pressing Cancel shuts down the database, pressing OK causes the table to be updated and the code never run again.
Hope this helps, jobo123
 
Hi jobo123

Thank you very much. I guess that's the best way to do. And as you said, i get much more control over the function this way.

have a nice day.

100bure
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top