Stuart McLachlan
stuart at lexacorp.com.pg
Tue Mar 23 02:44:32 CST 2004
On 23 Mar 2004 at 18:21, Dean Ellis wrote:
> Hi guys
>
> Thanks for your websites showing the code for detecting CD Drive Letters. I
> don't think it's quite what I'm after. Correct me if I'm wrong, but one will
> only tell what type of drive the leter that I type in is, and the other just
> provides a list of drive letters to choose from.
>
> What I am after is some code that I can use so that when I open the db from
> the CD Rom in ANY machine, be it Laptop, Desktop, W98, XP yahda yahda yahda,
> It determines the CD Drive Letter. This will then enable me to use that
> information to create a file path to some media that can then be used by the
> Active X Controls, or to view some images.
>
If you are opening the db from the CD ROM, you don't need to mess
about identifying a CD ROM, you just need to identify where the
application is.
Left$(Currentdb.Name,1) will give you the driveletter that the
application is on.
Here's the function I use to get the actual directory it is in:
Static Function ApplDir() As String
Dim strApplDir As String
Dim strTemp As String
If strApplDir = "" Then
strTemp = DBEngine(0)(0).Name
strApplDir = Left$(strTemp, InStrRev(strTemp, "\"))
End If
ApplDir = strApplDir
End Function
--
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System
Support.