Idenitfying the first time a database is run

J

jsccorps

Is there a way in Access 2003 to identify the first time a newly installed
database is run? I want to add a module that is invoked on the first start up.
 
J

jimati

You can create a macro and name it "autoexec" It will run every time the
database opens. You can set it up so that it runs the first time and refers
to whatever module you want, then in your module, you can delete the macro so
that it won't run anymore.

One other way I do it is to create a table with one field and one record.
The field is a "yes/no". When the database opens to the first form, I have
the database check to see if the field in that particular table is true or
false, if false, I have it run my code. At the end of the code I have it
update that record to true so that it won't run the code anymore.

Either way should work.
 
J

John Nurick

Hi,

One way is to add a little table:

tblSettings
Setting: Text 50, Primary key
Value: Text 255

with one record
Setting, Value
"FirstTime", "emiTtsriF"

Then when your startup form loads, have it do something like this:

If DCount("*", "tblSettings", _
"Setting='FirstTime' & Value='emiTtsriF'") Then
Call FirstTimeProcedure
CurrentDB.Execute _
"DELETE FROM tblSettings WHERE Setting='FirstTime';"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top