J
JHB
Hi:
I am trying to set up a process where a user can click a button and
backup the active database to another drive with a simple copy.
I have set the following code:
Function BUDB()
Dim OLDFILE As String
Dim BUFILE As String
Dim NOWSTRING As String
BUFOLDER = "C:/TASC/BACKUP/"
NOWSTRING = Format(Now(), "yyyy-mm-dd")
OLDFILE = "c:/TASC/DB/TASC_be.mdb"
BUFILE = BUFOLDER & NOWSTRING & " BACKUP TASC_be.mdb"
message1 = "Your Database has just been backed up. " & vbNewLine &
vbNewLine & "The backup File Name is: " & BUFILE & "." & vbNewLine &
vbNewLine & " It is strongly suggested that you copy that file to a
secure location (such as Dropbox). "
namemsg = "Backup Done"
FileCopy OLDFILE, BUFILE
MsgBox message1, vbOKOnly, namemsg
End Function
This code is called through a macro, which in turn opens a form.
The process works fine under most conditions, but after execution of
some macro/vba-code combinations I get an error code 70 when I try
and execute it, This error does not allow me to copy the file. I have
reduced the number of conditions this happens by going through all
macros to be certain I have closed all hidden forms, but a couple of
conditions continue to elude me.
Does anyone have any suggestions as to how I could either override
this error situation, or find it! For example, is there ANY was one
can see all hidden forms so I can be certain they are closed? Is there
some other condition that could be causing the write to fail?
Help much appreciated.
John Baker
I am trying to set up a process where a user can click a button and
backup the active database to another drive with a simple copy.
I have set the following code:
Function BUDB()
Dim OLDFILE As String
Dim BUFILE As String
Dim NOWSTRING As String
BUFOLDER = "C:/TASC/BACKUP/"
NOWSTRING = Format(Now(), "yyyy-mm-dd")
OLDFILE = "c:/TASC/DB/TASC_be.mdb"
BUFILE = BUFOLDER & NOWSTRING & " BACKUP TASC_be.mdb"
message1 = "Your Database has just been backed up. " & vbNewLine &
vbNewLine & "The backup File Name is: " & BUFILE & "." & vbNewLine &
vbNewLine & " It is strongly suggested that you copy that file to a
secure location (such as Dropbox). "
namemsg = "Backup Done"
FileCopy OLDFILE, BUFILE
MsgBox message1, vbOKOnly, namemsg
End Function
This code is called through a macro, which in turn opens a form.
The process works fine under most conditions, but after execution of
some macro/vba-code combinations I get an error code 70 when I try
and execute it, This error does not allow me to copy the file. I have
reduced the number of conditions this happens by going through all
macros to be certain I have closed all hidden forms, but a couple of
conditions continue to elude me.
Does anyone have any suggestions as to how I could either override
this error situation, or find it! For example, is there ANY was one
can see all hidden forms so I can be certain they are closed? Is there
some other condition that could be causing the write to fail?
Help much appreciated.
John Baker