Re: Dir Function
- From: "box2003" <spambox03@xxxxxxxxx>
- Date: Fri, 10 Mar 2006 19:58:41 -0500
You have raised an interesting point I had not even considered about
"Program Files" folder in the program installation and the API call. Would
you be able to direct me to the API syntax that would check for the program
installation?
Thanks
"Wayne Morgan" <comprev_gothroughthenewsgroup@xxxxxxxxxxx> wrote in message
news:u7DjLJFRGHA.1728@xxxxxxxxxxxxxxxxxxxxxxx
While you can do what you have, the <> should be = and "Program Files" isthe
missing from the Dir(). Also, I would actually recommend verifying that
file exists at all, not just assume that because the mdb file isn't therethe
that the mde is.
strFileName = Dir("C:\Program Files\Customer Info\customer.MD?")
If strFileName <> "" Then
Set dbsCustomer = OpenDatabase("C:\Program Files\Customer Info\" &
strFileName)
End If
Also, are you installing in "C:\Program Files" or are you installing in
defined Program Files folder (i.e. Windows wasn't installed on the C:..mde
drive). If the latter, you would need to do an API call to get the defined
folder. You could also check for the "ProgramFiles" environment variable.
The API call is preferable.
--
Wayne Morgan
MS Access MVP
"box2003" <spambox03@xxxxxxxxx> wrote in message
news:Ox7$waERGHA.1160@xxxxxxxxxxxxxxxxxxxxxxx
I created a database in .mdb format and want to distribute locally in
format. Part of my code below checks for either the .mde or .mdb format
and
opens the database accordingly. Is this a correct method or is there a
better way. The purpose is to allow me to test and develop this
application
in .mdb format and then create the .mde format and still have the
application run in either formats.
If Dir("C:\Customer Info\customer.MDB") <> "" Then
Set dbsCustomer = OpenDatabase("C:\Program Files\Customer
Info\Customer.mde")
else
Set dbsCustomer = OpenDatabase("C:\Program Files\Customer
Info\Customer.mdb")
End If
.
- Follow-Ups:
- Re: Dir Function
- From: Wayne Morgan
- Re: Dir Function
- From: Wayne Morgan
- Re: Dir Function
- References:
- Dir Function
- From: box2003
- Re: Dir Function
- From: Wayne Morgan
- Dir Function
- Prev by Date: Re: Sample Code to Accept form data, then write it to a table
- Next by Date: Re: 4 combo boxes need and/or query for single or multiple sorts
- Previous by thread: Re: Dir Function
- Next by thread: Re: Dir Function
- Index(es):
Relevant Pages
|