Autoexec with vba

NigelShaw

Registered User.
Local time
Today, 12:23
Joined
Jan 11, 2008
Messages
1,575
Hi

I question I am currently struggling with.

I have a routine that will make an autoexec into another database. Is there a way to check if one already exists and if it does, do not create a new one but instead, add the macro that runs the function to it.

Any ideas?


Nidge
 
Use the Dir() function to verify if the database file already exists.

Code:
    If Dir(\\server\partition\directory\yourfile.mdb) = "" Then
        Create new file
    End If
 
Hi GHudson,

i may not have explained it thoroughly enough. The databases already exist. it is the AutoExec im trying to look for. basically, my routine currently adds an autoexec to a separate database to ensure the running of a certain routine. ( long story about that ). unfortunately, this runs the risk of overwriting an existing autoexec if one aleady exists in another database. my perfect solution would be to-

- check the other database for an existing autoexec. if one exists, and the macro 'RunStarter()' to the top line of the autoexec so this runs first.
- if one doesnt exist, create a new autoexec with the line 'RunStarter() so this runs first.

the macro is part of a routine that can add a facility to any database so for the reasoning of the test as some databases can have an autoexec already?


hope thats clearer lol :eek:


Nidge
 

Users who are viewing this thread

Back
Top Bottom