Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Current CD-ROM Drive Letter


Message #1 by "Maha Arupputhan Pappan" <mahap@p...> on Mon, 20 May 2002 03:58:19
Hi all,

Good day.

I have create a CD-ROM with 2 .mdb files and a SETUP.MDE file in it. When 
the user double-click the SETUP.MDE file from the CD-ROM, it will start a 
Setup form. Once the user click the Setup button, it will then copy the 2 
files into respective folders in C:\ drive and creates an icon in the 
Desktop.

However, I have hard-coded the CD-ROM drive as D: drive. Now, I need your 
assistance to find the current CD-ROM drive in use. For example, a 
computer with just one CD-ROM drive will have no problem running this 
setup. If a computer were to have two CD-ROM drives than I foresee there 
will be a problem. If the user uses CD-ROM drive (lets say H: drive) then 
I will have problem copying the files.

How can I find the Current CD-ROM Drive Letter in use by the user? If the 
current CD-ROM drive in use is H: than, it must always remain H: drive.

Thanks,
Maha.
Message #2 by "George Oro" <george@c...> on Mon, 20 May 2002 09:10:01 +0400
Maha,
Sorry I can't help you but can you share to me your Setup code specially to creates an icon in the Desktop.

Cheers,
George


-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Monday, May 20, 2002 3:58 AM
To: Access
Subject: [access] Current CD-ROM Drive Letter


Hi all,

Good day.

I have create a CD-ROM with 2 .mdb files and a SETUP.MDE file in it. When 
the user double-click the SETUP.MDE file from the CD-ROM, it will start a 
Setup form. Once the user click the Setup button, it will then copy the 2 
files into respective folders in C:\ drive and creates an icon in the 
Desktop.

However, I have hard-coded the CD-ROM drive as D: drive. Now, I need your 
assistance to find the current CD-ROM drive in use. For example, a 
computer with just one CD-ROM drive will have no problem running this 
setup. If a computer were to have two CD-ROM drives than I foresee there 
will be a problem. If the user uses CD-ROM drive (lets say H: drive) then 
I will have problem copying the files.

How can I find the Current CD-ROM Drive Letter in use by the user? If the 
current CD-ROM drive in use is H: than, it must always remain H: drive.

Thanks,
Maha.

Message #3 by "Wesley Kendrick" <wez.k@n...> on Mon, 20 May 2002 08:41:10 +0100
Hi Maha, if you go to the MSDN website, you can find details of how to
incorporate the Open File dialog box in your program.
The link is
http://msdn.microsoft.com/library/en-us/dnima)1/html/ima0201.asp?frame=true

regards, Wesley Kendrick

----- Original Message -----
From: "Maha Arupputhan Pappan" <mahap@p...>
To: "Access" <access@p...>
Sent: Monday, May 20, 2002 3:58 AM
Subject: [access] Current CD-ROM Drive Letter


> Hi all,
>
> Good day.
>
> I have create a CD-ROM with 2 .mdb files and a SETUP.MDE file in it. When
> the user double-click the SETUP.MDE file from the CD-ROM, it will start a
> Setup form. Once the user click the Setup button, it will then copy the 2
> files into respective folders in C:\ drive and creates an icon in the
> Desktop.
>
> However, I have hard-coded the CD-ROM drive as D: drive. Now, I need your
> assistance to find the current CD-ROM drive in use. For example, a
> computer with just one CD-ROM drive will have no problem running this
> setup. If a computer were to have two CD-ROM drives than I foresee there
> will be a problem. If the user uses CD-ROM drive (lets say H: drive) then
> I will have problem copying the files.
>
> How can I find the Current CD-ROM Drive Letter in use by the user? If the
> current CD-ROM drive in use is H: than, it must always remain H: drive.
>
> Thanks,
> Maha.
>

Message #4 by "Maha Arupputhan Pappan" <mahap@p...> on Tue, 21 May 2002 02:09:41
Hi George,

Below is the code:

Private Sub Setup_Click()

    Dim MyFile As String, MyDataFile As String
    Dim File2Copy As String, NewFile As String
    Dim Data2Copy As String, NewData As String
    Dim oShell As IWshShell_Class
    Dim oShortCut As IWshShortcut_Class
    Dim sDesktop As String          ' path of desktop
    Dim sTargetPath As String       ' path for RCS.MDB
    Dim sPrograms As String
    
    MyFile = Dir("C:\RCS", vbDirectory)
    MyDataFile = Dir("C:\RCSDATA", vbDirectory)
    
    'On Error GoTo vbErrorHandler
    
    Set oShell = New IWshShell_Class        ' Create shell object
    ' get desktop path
    sDesktop = oShell.SpecialFolders.Item("Desktop")
    ' get programs path
    sPrograms = oShell.SpecialFolders.Item("Programs")
        
    If Len(MyFile) = 0 And Len(MyDataFile) = 0 Then
    
        MsgBox "Folders will be created.", vbInformation, "Create Folder"
        MkDir ("C:\RCS")
        MkDir ("C:\RCSDATA")
        MkDir ("C:\RCSDATA\DATA")
        MkDir ("C:\RCSDATA\DATA\MANPOWER")
        File2Copy = "D:\manpower.mdb"
        Data2Copy = "D:\Data\Manpower\Manpower.mdb"
        NewFile = "c:\rcs\manpower.mdb"
        NewData = "c:\rcsdata\data\manpower\manpower.mdb"
        FileCopy File2Copy, NewFile
        FileCopy Data2Copy, NewData
        
    Else
    
        MsgBox "Folder already exist.", vbInformation, "Check Folder..."
        Exit Sub
        
    End If
    
    ' Create shortcut
    Set oShortCut = oShell.CreateShortcut(sDesktop & "\RCS.lnk")
    
    ' Set Shortcut Properties
    With oShortCut
        sTargetPath = "c:\rcs"
        .TargetPath = sTargetPath & "\manpower.mdb"
        .Arguments = ""
        .WorkingDirectory = "c:\rcs"
        .Save
    End With
    
'vbErrorHandler:
 '   MsgBox Err.Description, , "Create Shortcut"
    
    'DoCmd.Close
    DoCmd.Quit
    
End Sub

Hope this helps you.

Thanks,
Maha


> Maha,
Sorry I can't help you but can you share to me your Setup code specially 
to creates an icon in the Desktop.

Cheers,
George


-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Monday, May 20, 2002 3:58 AM
To: Access
Subject: [access] Current CD-ROM Drive Letter


Hi all,

Good day.

I have create a CD-ROM with 2 .mdb files and a SETUP.MDE file in it. When 
the user double-click the SETUP.MDE file from the CD-ROM, it will start a 
Setup form. Once the user click the Setup button, it will then copy the 2 
files into respective folders in C:\ drive and creates an icon in the 
Desktop.

However, I have hard-coded the CD-ROM drive as D: drive. Now, I need your 
assistance to find the current CD-ROM drive in use. For example, a 
computer with just one CD-ROM drive will have no problem running this 
setup. If a computer were to have two CD-ROM drives than I foresee there 
will be a problem. If the user uses CD-ROM drive (lets say H: drive) then 
I will have problem copying the files.

How can I find the Current CD-ROM Drive Letter in use by the user? If the 
current CD-ROM drive in use is H: than, it must always remain H: drive.

Thanks,
Maha.

Message #5 by "George Oro" <george@c...> on Tue, 21 May 2002 10:01:49 +0400
Hi Maha,
Many thanks for the code but when I tried it I'm having a Compile Error: "User-defined not define "
in this area. 

    Dim oShell As IWshShell_Class
    Dim oShortCut As IWshShortcut_Class

Is there any special reference to be define to obtain this or ?, please help...


Cheers,
George



-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Tuesday, May 21, 2002 2:10 AM
To: Access
Subject: [access] RE: Current CD-ROM Drive Letter


Hi George,

Below is the code:

Private Sub Setup_Click()

    Dim MyFile As String, MyDataFile As String
    Dim File2Copy As String, NewFile As String
    Dim Data2Copy As String, NewData As String
    Dim oShell As IWshShell_Class
    Dim oShortCut As IWshShortcut_Class
    Dim sDesktop As String          ' path of desktop
    Dim sTargetPath As String       ' path for RCS.MDB
    Dim sPrograms As String
    
    MyFile = Dir("C:\RCS", vbDirectory)
    MyDataFile = Dir("C:\RCSDATA", vbDirectory)
    
    'On Error GoTo vbErrorHandler
    
    Set oShell = New IWshShell_Class        ' Create shell object
    ' get desktop path
    sDesktop = oShell.SpecialFolders.Item("Desktop")
    ' get programs path
    sPrograms = oShell.SpecialFolders.Item("Programs")
        
    If Len(MyFile) = 0 And Len(MyDataFile) = 0 Then
    
        MsgBox "Folders will be created.", vbInformation, "Create Folder"
        MkDir ("C:\RCS")
        MkDir ("C:\RCSDATA")
        MkDir ("C:\RCSDATA\DATA")
        MkDir ("C:\RCSDATA\DATA\MANPOWER")
        File2Copy = "D:\manpower.mdb"
        Data2Copy = "D:\Data\Manpower\Manpower.mdb"
        NewFile = "c:\rcs\manpower.mdb"
        NewData = "c:\rcsdata\data\manpower\manpower.mdb"
        FileCopy File2Copy, NewFile
        FileCopy Data2Copy, NewData
        
    Else
    
        MsgBox "Folder already exist.", vbInformation, "Check Folder..."
        Exit Sub
        
    End If
    
    ' Create shortcut
    Set oShortCut = oShell.CreateShortcut(sDesktop & "\RCS.lnk")
    
    ' Set Shortcut Properties
    With oShortCut
        sTargetPath = "c:\rcs"
        .TargetPath = sTargetPath & "\manpower.mdb"
        .Arguments = ""
        .WorkingDirectory = "c:\rcs"
        .Save
    End With
    
'vbErrorHandler:
 '   MsgBox Err.Description, , "Create Shortcut"
    
    'DoCmd.Close
    DoCmd.Quit
    
End Sub

Hope this helps you.

Thanks,
Maha


> Maha,
Sorry I can't help you but can you share to me your Setup code specially 
to creates an icon in the Desktop.

Cheers,
George


-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Monday, May 20, 2002 3:58 AM
To: Access
Subject: [access] Current CD-ROM Drive Letter


Hi all,

Good day.

I have create a CD-ROM with 2 .mdb files and a SETUP.MDE file in it. When 
the user double-click the SETUP.MDE file from the CD-ROM, it will start a 
Setup form. Once the user click the Setup button, it will then copy the 2 
files into respective folders in C:\ drive and creates an icon in the 
Desktop.

However, I have hard-coded the CD-ROM drive as D: drive. Now, I need your 
assistance to find the current CD-ROM drive in use. For example, a 
computer with just one CD-ROM drive will have no problem running this 
setup. If a computer were to have two CD-ROM drives than I foresee there 
will be a problem. If the user uses CD-ROM drive (lets say H: drive) then 
I will have problem copying the files.

How can I find the Current CD-ROM Drive Letter in use by the user? If the 
current CD-ROM drive in use is H: than, it must always remain H: drive.

Thanks,
Maha.


Message #6 by "Maha Arupputhan Pappan" <mahap@p...> on Tue, 21 May 2002 11:46:18
Sorry George,

Please add the following reference:
1. Microsoft Access Library.
2. Microsoft ActiveX Data Object.

Thanks,
Maha

> Hi Maha,
Many thanks for the code but when I tried it I'm having a Compile 
Error: "User-defined not define "
in this area. 

    Dim oShell As IWshShell_Class
    Dim oShortCut As IWshShortcut_Class

Is there any special reference to be define to obtain this or ?, please 
help...


Cheers,
George



-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Tuesday, May 21, 2002 2:10 AM
To: Access
Subject: [access] RE: Current CD-ROM Drive Letter


Hi George,

Below is the code:

Private Sub Setup_Click()

    Dim MyFile As String, MyDataFile As String
    Dim File2Copy As String, NewFile As String
    Dim Data2Copy As String, NewData As String
    Dim oShell As IWshShell_Class
    Dim oShortCut As IWshShortcut_Class
    Dim sDesktop As String          ' path of desktop
    Dim sTargetPath As String       ' path for RCS.MDB
    Dim sPrograms As String
    
    MyFile = Dir("C:\RCS", vbDirectory)
    MyDataFile = Dir("C:\RCSDATA", vbDirectory)
    
    'On Error GoTo vbErrorHandler
    
    Set oShell = New IWshShell_Class        ' Create shell object
    ' get desktop path
    sDesktop = oShell.SpecialFolders.Item("Desktop")
    ' get programs path
    sPrograms = oShell.SpecialFolders.Item("Programs")
        
    If Len(MyFile) = 0 And Len(MyDataFile) = 0 Then
    
        MsgBox "Folders will be created.", vbInformation, "Create Folder"
        MkDir ("C:\RCS")
        MkDir ("C:\RCSDATA")
        MkDir ("C:\RCSDATA\DATA")
        MkDir ("C:\RCSDATA\DATA\MANPOWER")
        File2Copy = "D:\manpower.mdb"
        Data2Copy = "D:\Data\Manpower\Manpower.mdb"
        NewFile = "c:\rcs\manpower.mdb"
        NewData = "c:\rcsdata\data\manpower\manpower.mdb"
        FileCopy File2Copy, NewFile
        FileCopy Data2Copy, NewData
        
    Else
    
        MsgBox "Folder already exist.", vbInformation, "Check Folder..."
        Exit Sub
        
    End If
    
    ' Create shortcut
    Set oShortCut = oShell.CreateShortcut(sDesktop & "\RCS.lnk")
    
    ' Set Shortcut Properties
    With oShortCut
        sTargetPath = "c:\rcs"
        .TargetPath = sTargetPath & "\manpower.mdb"
        .Arguments = ""
        .WorkingDirectory = "c:\rcs"
        .Save
    End With
    
'vbErrorHandler:
 '   MsgBox Err.Description, , "Create Shortcut"
    
    'DoCmd.Close
    DoCmd.Quit
    
End Sub

Hope this helps you.

Thanks,
Maha


> Maha,
Sorry I can't help you but can you share to me your Setup code specially 
to creates an icon in the Desktop.

Cheers,
George


-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Monday, May 20, 2002 3:58 AM
To: Access
Subject: [access] Current CD-ROM Drive Letter


Hi all,

Good day.

I have create a CD-ROM with 2 .mdb files and a SETUP.MDE file in it. When 
the user double-click the SETUP.MDE file from the CD-ROM, it will start a 
Setup form. Once the user click the Setup button, it will then copy the 2 
files into respective folders in C:\ drive and creates an icon in the 
Desktop.

However, I have hard-coded the CD-ROM drive as D: drive. Now, I need your 
assistance to find the current CD-ROM drive in use. For example, a 
computer with just one CD-ROM drive will have no problem running this 
setup. If a computer were to have two CD-ROM drives than I foresee there 
will be a problem. If the user uses CD-ROM drive (lets say H: drive) then 
I will have problem copying the files.

How can I find the Current CD-ROM Drive Letter in use by the user? If the 
current CD-ROM drive in use is H: than, it must always remain H: drive.

Thanks,
Maha.


Message #7 by "George Oro" <george@c...> on Tue, 21 May 2002 16:05:53 +0400
Maha,
You mean this references:
1. Microsoft Access 9.0 Object Library
2. Microsoft ActiveX Data Object 2.1 Library

Actually it's already defined but still I'm having the same error. 

Cheers,
George



-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Tuesday, May 21, 2002 11:46 AM
To: Access
Subject: [access] RE: Current CD-ROM Drive Letter


Sorry George,

Please add the following reference:
1. Microsoft Access Library.
2. Microsoft ActiveX Data Object.

Thanks,
Maha

> Hi Maha,
Many thanks for the code but when I tried it I'm having a Compile 
Error: "User-defined not define "
in this area. 

    Dim oShell As IWshShell_Class
    Dim oShortCut As IWshShortcut_Class

Is there any special reference to be define to obtain this or ?, please 
help...


Cheers,
George



-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Tuesday, May 21, 2002 2:10 AM
To: Access
Subject: [access] RE: Current CD-ROM Drive Letter


Hi George,

Below is the code:

Private Sub Setup_Click()

    Dim MyFile As String, MyDataFile As String
    Dim File2Copy As String, NewFile As String
    Dim Data2Copy As String, NewData As String
    Dim oShell As IWshShell_Class
    Dim oShortCut As IWshShortcut_Class
    Dim sDesktop As String          ' path of desktop
    Dim sTargetPath As String       ' path for RCS.MDB
    Dim sPrograms As String
    
    MyFile = Dir("C:\RCS", vbDirectory)
    MyDataFile = Dir("C:\RCSDATA", vbDirectory)
    
    'On Error GoTo vbErrorHandler
    
    Set oShell = New IWshShell_Class        ' Create shell object
    ' get desktop path
    sDesktop = oShell.SpecialFolders.Item("Desktop")
    ' get programs path
    sPrograms = oShell.SpecialFolders.Item("Programs")
        
    If Len(MyFile) = 0 And Len(MyDataFile) = 0 Then
    
        MsgBox "Folders will be created.", vbInformation, "Create Folder"
        MkDir ("C:\RCS")
        MkDir ("C:\RCSDATA")
        MkDir ("C:\RCSDATA\DATA")
        MkDir ("C:\RCSDATA\DATA\MANPOWER")
        File2Copy = "D:\manpower.mdb"
        Data2Copy = "D:\Data\Manpower\Manpower.mdb"
        NewFile = "c:\rcs\manpower.mdb"
        NewData = "c:\rcsdata\data\manpower\manpower.mdb"
        FileCopy File2Copy, NewFile
        FileCopy Data2Copy, NewData
        
    Else
    
        MsgBox "Folder already exist.", vbInformation, "Check Folder..."
        Exit Sub
        
    End If
    
    ' Create shortcut
    Set oShortCut = oShell.CreateShortcut(sDesktop & "\RCS.lnk")
    
    ' Set Shortcut Properties
    With oShortCut
        sTargetPath = "c:\rcs"
        .TargetPath = sTargetPath & "\manpower.mdb"
        .Arguments = ""
        .WorkingDirectory = "c:\rcs"
        .Save
    End With
    
'vbErrorHandler:
 '   MsgBox Err.Description, , "Create Shortcut"
    
    'DoCmd.Close
    DoCmd.Quit
    
End Sub

Hope this helps you.

Thanks,
Maha


> Maha,
Sorry I can't help you but can you share to me your Setup code specially 
to creates an icon in the Desktop.

Cheers,
George


-----Original Message-----
From: Maha Arupputhan Pappan [mailto:mahap@p...]
Sent: Monday, May 20, 2002 3:58 AM
To: Access
Subject: [access] Current CD-ROM Drive Letter


Hi all,

Good day.

I have create a CD-ROM with 2 .mdb files and a SETUP.MDE file in it. When 
the user double-click the SETUP.MDE file from the CD-ROM, it will start a 
Setup form. Once the user click the Setup button, it will then copy the 2 
files into respective folders in C:\ drive and creates an icon in the 
Desktop.

However, I have hard-coded the CD-ROM drive as D: drive. Now, I need your 
assistance to find the current CD-ROM drive in use. For example, a 
computer with just one CD-ROM drive will have no problem running this 
setup. If a computer were to have two CD-ROM drives than I foresee there 
will be a problem. If the user uses CD-ROM drive (lets say H: drive) then 
I will have problem copying the files.

How can I find the Current CD-ROM Drive Letter in use by the user? If the 
current CD-ROM drive in use is H: than, it must always remain H: drive.

Thanks,
Maha.



Message #8 by Peter Biddlecombe <PBiddlecombe@T...> on Tue, 21 May 2002 15:53:00 +0100
Maha,

You need to find documentation on the FileSystemObject object and its
members. It includes a Drives property - a collection of Drive objects.
Each drive has a DriveType property, a number indicating whether
it's a CD-ROM drive. Note that the 'Remote' and 'CDROM' constants for   
this
property are mutually exclusive. A Remote CDROM apparently gets described   

as Remote.

Here's some bodgy VB code that does the sort of thing you want. You need
to add a reference to the Microsoft Scripting Runtime to get the use of
the FileSystemObject object and its friends.

    Private Sub Form_Load()
        Dim fso As New FileSystemObject
        Dim d As drive
      

        For Each d In fso.Drives
            If d.DriveType = CDRom Then
                MsgBox d.DriveLetter & " is a CD drive"
            End If
        Next d
    End Sub


 -----Original Message-----

Subject: Current CD-ROM Drive Letter
From: "Maha Arupputhan Pappan" <mahap@p...>
Date: Mon, 20 May 2002 03:58:19
X-Message-Number: 2

Hi all,

Good day.

I have create a CD-ROM with 2 .mdb files and a SETUP.MDE file in it. When   

the user double-click the SETUP.MDE file from the CD-ROM, it will start a   

Setup form. Once the user click the Setup button, it will then copy the 2   

files into respective folders in C:\ drive and creates an icon in the
Desktop.

However, I have hard-coded the CD-ROM drive as D: drive. Now, I need your   

assistance to find the current CD-ROM drive in use. For example, a
computer with just one CD-ROM drive will have no problem running this
setup. If a computer were to have two CD-ROM drives than I foresee there
will be a problem. If the user uses CD-ROM drive (lets say H: drive) then   

I will have problem copying the files.

How can I find the Current CD-ROM Drive Letter in use by the user? If the   

current CD-ROM drive in use is H: than, it must always remain H: drive.

Thanks,
Maha.
 ----------------------------------------------------------------------

   

   

   

   


  Return to Index