Bill Patten
bill_Patten at earthlink.net
Sat Sep 2 13:20:37 CDT 2006
Hi Chris,
Will this help? Its from the API Guide 2.7, you could loop through the
drives till there where non and When Z for example came back as "backup" or
what ever it is You would know.
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA"
(ByVal nDrive As String) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: KPDTeam at Allapi.net
'Set the graphic mode to persistent
Me.AutoRedraw = True
'Get information about the C:\
Select Case GetDriveType("C:\")
Case 2
Me.Print "Removable"
Case 3
Me.Print "Drive Fixed"
Case Is = 4
Me.Print "Remote"
Case Is = 5
Me.Print "Cd-Rom"
Case Is = 6
Me.Print "Ram disk"
Case Else
Me.Print "Unrecognized"
End Select
End Sub
----- Original Message -----
From: "Chris Enright" <cclenright at yahoo.com>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Saturday, September 02, 2006 11:04 AM
Subject: [AccessD] Where is the Zip Drive?
The little I know about VBA I got from this site. Every day I read every
email! Eighty percent goes right over my head! But the little I have
understood from AccessD makes me a living. J
I have a program that the customer loves. He keeps opening new branches
and, because he is slightly computer literate (and therefore dangerous), he
happily installs FE and, a BE with blank tables, on each new PC.
Unfortunately, the people who supply the PCs to him configure them
differently each time they supply one.
My program is designed so that, at close down, it will backup the BE to an
Iola Zip Disk. This is normally E:. (Based on A: Floppy, B: (showing your
age), C: Hard Disk, D: CD/DVD.)
However, sometimes there seem to be all sorts of odd drives, even phantom
disk partitions and the Zip Drive isn't where I programmed it.
The customer LOVES going in to my FE and sorting it out! Inevitably I then
spend hours (because he didn't tell me what he had done) tracking down a
problem on a new installation.
Below is my, very crude, (please don't laugh, it normally works), backup
function. Could someone please correct it, either to the list or offline, so
that it will detect where the Zip Disk is?
TIA
Chris
{Oh I am embarrassed about showing my code to you lot}
----------------------------------------------------------------------------------
Private Function Backup()
Dim strNewDBName As String
Dim strOldDbName As String
Dim fso
Dim file As String
Dim msg As String
On Error GoTo Err_Backup
DoCmd.Hourglass True
' copy database
strOldDbName = "C:\Startan\Startan BE.mdb"
strNewDBName = "D:\BuExp.mdb"
FileCopy strOldDbName, strNewDBName
' if a previous backup exists then delete it
file = "D:\StartanBU.mdb"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(file) Then
fso.DeleteFile file, True
End If
' rename backup database
Name strNewDBName As file
DoCmd.Hourglass False
Exit_Backup:
Exit Function
Err_Backup:
msg = "Make sure the Zip Disk is in the computer " '& Chr(10)
msg = msg & "and that the drive lights have stopped flashing "
msg = msg & "and then press Enter"
MsgBox msg
Resume
End Function
Still blushing, going for a drink!!
Chris
---------------------------------
Stay in the know. Pulse on the new Yahoo.com. Check it out.
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com