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

Long Flie Names and Exclusive Access

Status
Not open for further replies.

JPeters

MIS
Jul 25, 2001
423
US
Using this Code that tlbroadbent wrote about a year ago here..


Function OpenDatabaseExclusive()
Dim AccPath As String, rc As Double, dbPath As String
Dim db As DAO.Database

Set db = CurrentDb
dbPath = db.Name
db.Close
AccPath = SysCmd(acSysCmdAccessDir) & "msaccess.exe "
rc = Shell(AccPath & dbPath & " /excl", vbNormalFocus)
Quit

End Function

I put this as a module function that runs in my autoexec macro to ensure that the database is only opened in Exlcusive mode. However, while I'm sure it would work if the database name contained no spaces, it doesn't work with my current database name like "my database.mdb" ... it gives me the error "unable to locate the database "my.mdb" ...

Any ideas on how to change the code so the entire database name gets kicked into gear? Thanks much!
-Happen609
These things take time...
 
dbpath="""" & dbpath & """"
to put quotes around the whole filename

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top