links on CD

M

Maria Joao

How can I make links to open some files on a CD, and make
it work on differnt computers, since the CDROM have a
different letter in different computers?

Thanks

Maria Joao
 
A

Arvin Meyer

Maria Joao said:
How can I make links to open some files on a CD, and make
it work on differnt computers, since the CDROM have a
different letter in different computers?

Access MVP Graham Mandeno wrote the following code which will help you
locate the CD drive:

------------ code start ---------------
Option Explicit
Option Compare Text
Option Base 0

' © Graham Mandeno, Alpha Solutions, Auckland, New Zealand
' This code may be used and distributed freely on the condition
' that the above credit is included unchanged.

Private Declare Function GetLogicalDriveStrings _
Lib "kernel32" Alias "GetLogicalDriveStringsA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) _
As Long

Private Declare Function GetDriveType _
Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) _
As Long

Private Declare Function GetVolumeInformation _
Lib "kernel32" Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) _
As Long

Private Const DRIVE_UNKNOWN = 0
Private Const DRIVE_NOROOT = 1
Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6

Public Function CDRomPath(sVolumeLabel As String) As String
' Returns the path ("X:\") of the CD-ROM drive containing the given CD
' If not found, returns a null string
Static aCDPaths As Variant, sCDPath As String
Dim i As Integer
If IsEmpty(aCDPaths) Then aCDPaths = GetAvailableCDs
If Not IsNull(aCDPaths) Then
For i = 0 To UBound(aCDPaths)
sCDPath = aCDPaths(i)
If GetVolumeLabel(sCDPath) = sVolumeLabel Then
CDRomPath = sCDPath
Exit For
End If
Next
End If
End Function

Public Function GetAvailableCDs() As Variant
' Returns a zero-based string array of available CD-ROM drives
' Each element is in the form "X:\"
Dim aDrives() As String, sAllDrives As String, sOneDrive As String
Dim iDrives As Integer, iAllDrives As Integer, i As Integer
sAllDrives = String(26 * 4 + 1, 0)
iAllDrives = GetLogicalDriveStrings(Len(sAllDrives), sAllDrives) \ 4
For i = 0 To iAllDrives - 1
sOneDrive = Mid(sAllDrives, i * 4 + 1, 3)
If GetDriveType(sOneDrive) = DRIVE_CDROM Then
ReDim Preserve aDrives(iDrives)
aDrives(iDrives) = sOneDrive
iDrives = iDrives + 1
End If
Next
If iDrives Then
GetAvailableCDs = aDrives
Else
GetAvailableCDs = Null
End If
End Function

Public Function GetVolumeLabel(sDrivePath As String) As String
' Return the volume label of the media in drive "X:\"
Dim sLabel As String, iLen As Integer
sLabel = String$(14, 0)
If GetVolumeInformation(sDrivePath, sLabel, Len(sLabel), _
0, 0, 0, vbNullString, 0) > 0 Then
iLen = InStr(sLabel, vbNullChar) - 1
If iLen Then
GetVolumeLabel = Left$(sLabel, iLen)
Else
GetVolumeLabel = "(no label)"
End If
End If
End Function
---------------- code end ----------------------
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
M

Maria Joao

Thanks for that code
but now how can I re-direct the link to the CD? It is a
differnt link for each record

Maria Joao
 
V

Victor Delgadillo

Share the CD with a name and then either map a drive letter to the share
name or just access the CD through the share

--
Victor Delgadillo [MVP Access]
Miami, Florida

Consultas al grupo, asi todos nos beneficiamos.

_
 
A

Arvin Meyer

I am assuming that the database is running on each workstation, not on the
server. If not, run the front-end from the workstations. The database should
be split. I seriously doubt that each record is on a different machine. If
it is, you'll need to change that and move the data to a central
server.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Thanks for that code
but now how can I re-direct the link to the CD? It is a
differnt link for each record

Maria Joao
 
M

Maria joao

I nedd it to work in diferent machines with no conection
between them



-----Original Message-----
Share the CD with a name and then either map a drive letter to the share
name or just access the CD through the share

--
Victor Delgadillo [MVP Access]
Miami, Florida

Consultas al grupo, asi todos nos beneficiamos.

_
Arvin Meyer said:
Access MVP Graham Mandeno wrote the following code which will help you
locate the CD drive:

------------ code start ---------------
Option Explicit
Option Compare Text
Option Base 0

' © Graham Mandeno, Alpha Solutions, Auckland, New Zealand
' This code may be used and distributed freely on the condition
' that the above credit is included unchanged.

Private Declare Function GetLogicalDriveStrings _
Lib "kernel32" Alias "GetLogicalDriveStringsA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) _
As Long

Private Declare Function GetDriveType _
Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) _
As Long

Private Declare Function GetVolumeInformation _
Lib "kernel32" Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) _
As Long

Private Const DRIVE_UNKNOWN = 0
Private Const DRIVE_NOROOT = 1
Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6

Public Function CDRomPath(sVolumeLabel As String) As String
' Returns the path ("X:\") of the CD-ROM drive containing the given CD
' If not found, returns a null string
Static aCDPaths As Variant, sCDPath As String
Dim i As Integer
If IsEmpty(aCDPaths) Then aCDPaths = GetAvailableCDs
If Not IsNull(aCDPaths) Then
For i = 0 To UBound(aCDPaths)
sCDPath = aCDPaths(i)
If GetVolumeLabel(sCDPath) = sVolumeLabel Then
CDRomPath = sCDPath
Exit For
End If
Next
End If
End Function

Public Function GetAvailableCDs() As Variant
' Returns a zero-based string array of available CD-ROM drives
' Each element is in the form "X:\"
Dim aDrives() As String, sAllDrives As String, sOneDrive As String
Dim iDrives As Integer, iAllDrives As Integer, i As Integer
sAllDrives = String(26 * 4 + 1, 0)
iAllDrives = GetLogicalDriveStrings(Len(sAllDrives), sAllDrives) \ 4
For i = 0 To iAllDrives - 1
sOneDrive = Mid(sAllDrives, i * 4 + 1, 3)
If GetDriveType(sOneDrive) = DRIVE_CDROM Then
ReDim Preserve aDrives(iDrives)
aDrives(iDrives) = sOneDrive
iDrives = iDrives + 1
End If
Next
If iDrives Then
GetAvailableCDs = aDrives
Else
GetAvailableCDs = Null
End If
End Function

Public Function GetVolumeLabel(sDrivePath As String) As String
' Return the volume label of the media in drive "X:\"
Dim sLabel As String, iLen As Integer
sLabel = String$(14, 0)
If GetVolumeInformation(sDrivePath, sLabel, Len (sLabel), _
0, 0, 0, vbNullString, 0) > 0 Then
iLen = InStr(sLabel, vbNullChar) - 1
If iLen Then
GetVolumeLabel = Left$(sLabel, iLen)
Else
GetVolumeLabel = "(no label)"
End If
End If
End Function
---------------- code end ----------------------
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access


.
 
V

Victor Delgadillo

You can dump the files on a CD-R and then you can transport the CD to
another computer with a different drive letter. Just make sure there are no
"hard-coded" drives, but a relative drive for searching files.
You could also dump everything into a directory on the CD and then using the
SUBST K: D:\HardDisk
will substitute the letter K: for the path D:\HardDisk. In other words,
after this command (in DOS mode) you can refer to K: anything inside the
directory called HardDisk.

--
Victor Delgadillo MS-MVP Access
Miami, Florida

Mensajes a los grupos de noticia, asi todos nos beneficiamos!



I nedd it to work in diferent machines with no conection
between them



-----Original Message-----
Share the CD with a name and then either map a drive letter to the share
name or just access the CD through the share

--
Victor Delgadillo [MVP Access]
Miami, Florida

Consultas al grupo, asi todos nos beneficiamos.

_
Arvin Meyer said:
Access MVP Graham Mandeno wrote the following code which will help you
locate the CD drive:

------------ code start ---------------
Option Explicit
Option Compare Text
Option Base 0

' © Graham Mandeno, Alpha Solutions, Auckland, New Zealand
' This code may be used and distributed freely on the condition
' that the above credit is included unchanged.

Private Declare Function GetLogicalDriveStrings _
Lib "kernel32" Alias "GetLogicalDriveStringsA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) _
As Long

Private Declare Function GetDriveType _
Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) _
As Long

Private Declare Function GetVolumeInformation _
Lib "kernel32" Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) _
As Long

Private Const DRIVE_UNKNOWN = 0
Private Const DRIVE_NOROOT = 1
Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6

Public Function CDRomPath(sVolumeLabel As String) As String
' Returns the path ("X:\") of the CD-ROM drive containing the given CD
' If not found, returns a null string
Static aCDPaths As Variant, sCDPath As String
Dim i As Integer
If IsEmpty(aCDPaths) Then aCDPaths = GetAvailableCDs
If Not IsNull(aCDPaths) Then
For i = 0 To UBound(aCDPaths)
sCDPath = aCDPaths(i)
If GetVolumeLabel(sCDPath) = sVolumeLabel Then
CDRomPath = sCDPath
Exit For
End If
Next
End If
End Function

Public Function GetAvailableCDs() As Variant
' Returns a zero-based string array of available CD-ROM drives
' Each element is in the form "X:\"
Dim aDrives() As String, sAllDrives As String, sOneDrive As String
Dim iDrives As Integer, iAllDrives As Integer, i As Integer
sAllDrives = String(26 * 4 + 1, 0)
iAllDrives = GetLogicalDriveStrings(Len(sAllDrives), sAllDrives) \ 4
For i = 0 To iAllDrives - 1
sOneDrive = Mid(sAllDrives, i * 4 + 1, 3)
If GetDriveType(sOneDrive) = DRIVE_CDROM Then
ReDim Preserve aDrives(iDrives)
aDrives(iDrives) = sOneDrive
iDrives = iDrives + 1
End If
Next
If iDrives Then
GetAvailableCDs = aDrives
Else
GetAvailableCDs = Null
End If
End Function

Public Function GetVolumeLabel(sDrivePath As String) As String
' Return the volume label of the media in drive "X:\"
Dim sLabel As String, iLen As Integer
sLabel = String$(14, 0)
If GetVolumeInformation(sDrivePath, sLabel, Len (sLabel), _
0, 0, 0, vbNullString, 0) > 0 Then
iLen = InStr(sLabel, vbNullChar) - 1
If iLen Then
GetVolumeLabel = Left$(sLabel, iLen)
Else
GetVolumeLabel = "(no label)"
End If
End If
End Function
---------------- code end ----------------------
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access


.
 
V

Victor Delgadillo

Check the SUBST d: X:\dir options and you could apply this to 'adjust' the
drive you have used in your installation.
If you have to 'hard-code' a drive, like K:\directory... you may use the
SUBST command to 'create a K: drive' from wherever you have the files.

--
Victor Delgadillo [MVP Access]
Miami, Florida

Consultas al grupo, asi todos nos beneficiamos.

_
Can you explain it better?

I didn't understand how it works.


Thanks


Maria joao
-----Original Message-----
You can dump the files on a CD-R and then you can transport the CD to
another computer with a different drive letter. Just make sure there are no
"hard-coded" drives, but a relative drive for searching files.
You could also dump everything into a directory on the CD and then using the
SUBST K: D:\HardDisk
will substitute the letter K: for the path D:\HardDisk. In other words,
after this command (in DOS mode) you can refer to K: anything inside the
directory called HardDisk.

--
Victor Delgadillo MS-MVP Access
Miami, Florida

Mensajes a los grupos de noticia, asi todos nos beneficiamos!



I nedd it to work in diferent machines with no conection
between them



-----Original Message-----
Share the CD with a name and then either map a drive letter to the share
name or just access the CD through the share

--
Victor Delgadillo [MVP Access]
Miami, Florida

Consultas al grupo, asi todos nos beneficiamos.

_
Arvin Meyer said:
How can I make links to open some files on a CD, and make
it work on differnt computers, since the CDROM have a
different letter in different computers?

Access MVP Graham Mandeno wrote the following code which will help you
locate the CD drive:

------------ code start ---------------
Option Explicit
Option Compare Text
Option Base 0

' © Graham Mandeno, Alpha Solutions, Auckland, New Zealand
' This code may be used and distributed freely on the condition
' that the above credit is included unchanged.

Private Declare Function GetLogicalDriveStrings _
Lib "kernel32" Alias "GetLogicalDriveStringsA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) _
As Long

Private Declare Function GetDriveType _
Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) _
As Long

Private Declare Function GetVolumeInformation _
Lib "kernel32" Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) _
As Long

Private Const DRIVE_UNKNOWN = 0
Private Const DRIVE_NOROOT = 1
Private Const DRIVE_REMOVABLE = 2
Private Const DRIVE_FIXED = 3
Private Const DRIVE_REMOTE = 4
Private Const DRIVE_CDROM = 5
Private Const DRIVE_RAMDISK = 6

Public Function CDRomPath(sVolumeLabel As String) As String
' Returns the path ("X:\") of the CD-ROM drive containing the given CD
' If not found, returns a null string
Static aCDPaths As Variant, sCDPath As String
Dim i As Integer
If IsEmpty(aCDPaths) Then aCDPaths = GetAvailableCDs
If Not IsNull(aCDPaths) Then
For i = 0 To UBound(aCDPaths)
sCDPath = aCDPaths(i)
If GetVolumeLabel(sCDPath) = sVolumeLabel Then
CDRomPath = sCDPath
Exit For
End If
Next
End If
End Function

Public Function GetAvailableCDs() As Variant
' Returns a zero-based string array of available CD-
ROM
As


.
 

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

Similar Threads

Hide URL on opening from VBA 8
Personalize error message 1
How to close objects 1
Pages in Access 1
Links on CD 6
Problems with DataBase on CD 12
Holidays 2008 in Outlook 2000 2
Holidays 2008 11

Top