reference variable from another open database

G

Guest

Is it possible to pass a value from a variable in one database to a variable
in another?

I have an instance of Access that I'm using as a utility to update my
client's front end database when I produce a new version. However, I need to
pass the filepath of the existing location of the client's front end to the
utility so that it knows where to put the new version. I have no way of
predicting where my client(s) will put their copy of the front end, so I
can't hard code it.

I CAN hardcode the location of the new version - since I know that I will
always place that in the same folder every time... but without knowing where
to put the copy, I can't make my "utility" work.

Here's the sequence of events.

1. User opens his/her copy of front end database.
2. on startup, splash form compares version number of front end (FE) with
version number of back end (BE).
3. If they are different - then a new version is available. Ask user if they
want to update.
4. If user wants to update, then open utility (stored in same folder as BE)
5. HOPEFULLY - PASS string containing currentdb.name to utility (this is
what I don't know how to do)
6. close current version of FE
7. Utility deletes current version of FE
8. Utility copies new version of FEto location of current version of FE
9. Utility opens new version of FE
10. Utility closes
11. User proceeds to use new version of FE

Any ideas? I know the sequence works when I can hard-code the locations of
all the files - I just don't know how to make them variables to be able to
handle different locations of the current version of FE

Thanks!

Amanda Payton
 
J

John Nurick

Often the simplest way to do this sort of thing is to create a little
table in which to store this and other settings.

tblSettings
SettingName
SettingValue

This might just have the one record
SettingName,SettingValue
FEPath,"C:\Folder\File.mdb"

Then you can have your code set the new value by building and running an
update query (if necessary using an IN clause to specify that the field
is in a different database). To retrieve the value later, you can use
DLookup().

It's also worth taking a look at Tony Toews's Auto FE Updater, which
sounds as if it does everything you need: see http://www.granite.ab.ca
 
G

Guest

Here's how I solved my problem....

Since I use the shell command to open my utility - I added a /cmd section to
the prompt string, with the value of currentdb.name following /cmd.

Then I have the utility retrieve that value and use it.
When you use the Shell command - it's the same as using the command prompt
to open a program. In Access, when you use the command line to open, and use
the /cmd argument, you can retrieve the argument with the command( ) function.

I then set the filepath variable = command ( ) ... and the utility now
"knows" where the FE is stored!
 

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