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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a macro once in a session

Status
Not open for further replies.

genericjanedoe

Technical User
Nov 12, 2003
16
GB
Is there anyway of ensuring that a database carries out a macro only once during a user session?

I ask because I have developed an archive database in which to export all the older records from a project database. When the "archive record" field is filled in, a macro exports the record into a "holding" database and deletes it from the project database. (I have to have this holding database because each new export re-creates and overwrites the holding database.)

When I go into the archive database, an import macro imports records from the holding database and adds it as a new record into the archive. This macro is set up to run the minute I navigate away from the main menu. In order to stop the archive creating a duplicate record every time I move away from the menu page, I have the macro delete the holding database once the record has been imported.

So far, so good.

However, now of course when I navigate the archive database, the import macro tries to find the records in the now non-existent holding database, and I am faced with an "Input Data" dialogue box which I have to keep cancelling out of.

Any ideas as to what I do next? Many thanks :)
 
I would make a numeric variable ISDONE and start the import macro :
RUN
IF ISDONE=1 END THIS MACRO
....
Remainder of import routine
....
SET ISDONE=1

To be certain use an Open macro to set ISDONE to 0

But I'm not an expert.
 
A macro named OPEN will run one time when you open the APR file. Perhaps that would be a better place to put your export.

Sue Sloan
XpertSS.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top