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

Open database using Shell command help required

Status
Not open for further replies.

Sech

Programmer
Jul 5, 2002
137
GB
I have a small database that needs to open another database with workgroup settings on. The directory and filename of this database is stored in a table which I then get variables from to use in the Shell command line as follows:

sAccess = rsFileInfo("AccessPath")
sFISPath = """" & rsFileInfo("FISPath")
sFISName = rsFileInfo("FISName") & """"
sSwitches = " /wrkgrp " & rsFileInfo("FISPath") & "dbworkgroup.mdw /user dbadmin /pwd owner"

Retval = Shell(sAccess & " " & sFISPath & sFISName & sSwitches, vbMinimizedNoFocus)

This all works fine when the directory has no spaces in it, however I need it to open a database that is in a directory path with spaces in. When I try to run the above code for directory C:\Test 1\ instead of C:\Test\ I get the error "The command line you used to start Microsoft Access contains an option that Microsoft Access doesn't recognise". If I close this another error appears saying "Microsoft Access cannot find file 'C:\Test'. This file is required for start up.

Does anyone know how to run the Shell command for a path with spaces in, or an alternative command?
 
You would need to "" the path including the name of the DB.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top