Access & Command lines

B

blee

I have an database that I am opening with a bat file. This is being used to
open the contacts form by the telephone number calling.
The command line I am using is as follows:
start "" "c:\Database\Maintenance.mdb" /cmd %1
The correct form opens without a problem, Iam using autoexec macro that runs
code CheckCommandLine and I have a "Contacts" module:
Public Function CheckCommandLine()
If Len(Command) = 0 Then Exit Function
DoCmd.Openform "Contacts"
DoCmd.GoToControl "ContactId"
DoCmd.FindRecord Command
End Function

All great so far when the first call comes in the bat file is run by my
external software and the correct contact form is opened. But I have to close
the access data base for it to work for the next incoming call.
Help !! I need to leave the database open and the bat file just used to
"Filter" the form
 
J

Jeff Boyce

I don't understand...

I mean, I get that you want to be able to "pass in" a parameter when you
first start it up, but why resort to re-running the bat file when you have a
perfectly usable user-interface available once your Access application is
opened?

What about the idea of bypassing the bat file altogether and just opening
your Access application and using it?

JOPO (just one person's opinion)

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
D

Douglas J. Steele

Command line switches like /cmd are switches to msaccess.exe, not to the mdb
file. Your short-cut must include msaccess.exe in it:

start """C:\Program Files\Microsoft Office\Office\msaccess.exe"" " & _
"c:\Database\Maintenance.mdb" /cmd %1"

Note the extra double-quotes around the full path to msaccess.exe to handle
the fact that there are spaces in the folder name.

That being said, though, I don't see how you expect to get the value
represented by %1.
 
T

Tony Toews [MVP]

blee said:
I have an database that I am opening with a bat file. This is being used to
open the contacts form by the telephone number calling.

As Jeff and Doug have stated you can't pass in the phone number while
the database is open using a batch file to start up Access. However
your phone system software may offer some sort of alternative
solution. How do you get the phone number from the current software?
Does the phone system software allow for some automation?

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
 

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