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

Pass Access 97 Parameters when opening from command line

Status
Not open for further replies.

mincefish

Programmer
Sep 27, 2001
74
GB
I hope someone can help me!!

I am trying to get a an Access 97 database to run a form as soon as it opens - I don't think I'll have any problems with that, but what I'd like to do is pass it some parameters when the form is opened.

The module that the form will call requires a file name parsed to it. I could go down the lengthy route of searching the folder and picking up the name, but I'm exposing myself to files being left in the folder, etc...

Does anybody know if its possible to do pass parameters, and how do I get hold of these parameters when the database has opened?

Hope I've made myself clear!

Thanks

The mincefish
 
You can use /cmd xxxx on the command line.

make sure it is the last option on your command line. To read it back use the command function.
For example open your file with:
"C:\Program Files\Microsoft Office\Office\Msaccess.exe" "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb" /cmd "Orders"

and read it back

Function CheckCommandLine()
' Check value returned by Command function.
If Command = "Orders" Then
DoCmd.OpenForm "Orders"
ElseIf Command = "Employees" Then
DoCmd.OpenForm "Employees"
Else
Exit Function
End If
End Function


Hope thatgets you started.

B ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
Thanks Ben, you're a legend!! Saved me alot of time :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top