Full Version: Access startup switches
UtterAccess Forums > Microsoft® Access > Access Forms
I'm sure this is not the place to post this, but I don't know where it belongs and this seems to be one of the more active forums.
would like to be able to externally control the initial actions of an application. For example, I am utilizing an autoupdate routine that I copied from UA to keep my users updated with the latest release of the app. Works like a champ. However it always goes to the same network file and record to check version#. Again, works great- BUT I have a second app that is on a different version schedule (both work from a common BE database) that I'd like to control via a SECOND version record. I need some way that when I load the autoupdater, it knows which app I'm trying to load and therefore knows which version record to look at.
Oenvision a switch that I can include in the shortcut line like
C:\PROGRAMFILES\MSACCESS.EXE /SW1 - this says use version record #1
C:\...................................... /SW2 - this says use version record #2
I'm not in love with this solution so if someone has a workable suggestion, I'd like to hear it. What I don't want to do is duplicate the autoupdater and run it under different names, but right now that is the only solution I know how to make work.
Any comments or suggestions would, as always be very much appreciated.
I'm not familiar with the auto-updater you're using but you can include your own information on the command line using the /cmd switch. You can then read what came in behind that switch in Access using the Command() function. Search Access help for "Command Line Arguments" for more info.
The concept is exactly what I had in mind. but it seems these parameters cannot be placed in the Target Line of a windows desktop shortcut-
"D:\TRSDatabase\Copy of trsDBLocal.mdb" /cmd "4"
Oget nothing on the form with a text box where Control Source is =Command()
Any ideas??
If you're interested in the autoupdate, code was provided by a guy by the name of Eric Rosko in 2003. If you can't find the code, let me know and I'll send it.
When I use the /cmd switch I don't use quotes. Maybe try removing them in your shortcut. Here is an example of a string I execute with the Shell command to open the database:
:\Program Files\Microsoft Office\Office10\MSACCESS.exe "PathToDatabase" /wrkgrp PathToMDW /user MyUserID /pwd MyPassword /cmd Argument1=Value;Argument2=Value
Othen parse out the arguments and retrieve their values using the Command function. I checked and I am also able to have it return the whole string "Argument1=Value;Argument2=Value" using =Command() as a controlsource for a textbox on a form.
The auto-updater I use is home-grown and uses a VB exe to launch Access. It's quite different but works great. The command line arguments of the VB exe accepts a path to an ini file where I store any number of arguments and the program reads them before opening Access. That way all I have to do is change the contents of the network ini file and everyone's desktop shortcut is automatically take care of.
Let me know if removing the quoates works for you.
After starring at this for an hour or so, and re-reading your posts, help text, and my shortcut, etc etc. It suddenly dawned on me. The shortcut is pointed to the DATABASE file, not to the MSAccess.exe. The exe is opened by association in windows.
hanged the target line to include the exe and my form which had the Command() function displayed every way I could think of light up like a Xmas tree.
Final shortcut target line:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" D:\TRSDatabase\CmdtrsDBLocal.mdb /cmd "4"
Thanks for your help and getting me pointed in the right direction.
Ah, that makes sense. I'm glad it ended up working for you!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.