Open access database with a variable

G

Guest

Does anyone know of a way to open database and have it open a particualar
form and/or record, depending on a variable passed to it?

For example....I have a database where users input data and then email
others to input data. What I am looking to do is send a link in the email
with something like this.... "C:\myDB\myDatabase.mdb -report -123". I would
then want the form call "report" to open, then go to id number "123". Is this
at all possible? Even if I could call a function with a variable, such as
"C:\mydb.mdb -123", which would then call openReport(123) in my database.

Does anyone have any ideas?
 
G

Guest

There are few step
1. Use the Cmd in the command line to open the mdb with a variable
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "C:\MdbName.Mdb"
/CmdA

This line will pass "A" to the mdb that runs.

2. Create a function that this code
select case Command$ ' The command the returns the variable that passed
with the command line
case "A"
docmd.openreport "ReportName"
case "B"
docmd.OpenForm
End Select

3. Create a macro called AutoExec in the mdb, this macro will run
automatically when the mdb opens, call a function with this macro
 

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