Chris Enright
cclenright at yahoo.com
Sat Sep 2 13:04:48 CDT 2006
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 isnt where I programmed it.
The customer LOVES going in to my FE and sorting it out! Inevitably I then spend hours (because he didnt tell me what he had done) tracking down a problem on a new installation.
Below is my, very crude, (please dont 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.