J
James
I have a button that copies the back-end to a new file and renames it. At
first it would not work (unless saveing to root drive) because I didn't have
the "\" before the file name. Now it will save to a folder only but not the
root drive. How do let the user save the file anywhere?
Breakdown of code below:
I have three txtBoxes (txtfolderPath, txtDest, & txtsource)...txtFolderPath
is selected using a function GetOpenFileName by Ken Getz. It grabs the drive
and folder corretl, but it's my code that is screwing things up (the code
below).
---------------start code---------
Option Compare Database
Option Explicit
Dim DateNow As String
Dim DestinationFile As String
Private Sub cmdBackup_Click()
On Error GoTo Err_cmdBackup_Click
DestinationFile = Me.txtFolderPath & "\PLOG2005BE" & Format(DateNow,
"mmddyy") & ".bku"
Me.txtDest = DestinationFile
FileCopy Me.txtSource, Me.txtDest
MsgBox "Backup Successful.", , "PackageLog 2005"
Exit_cmdBackup_Click:
Exit Sub
Err_cmdBackup_Click:
MsgBox Err.Description
Resume Exit_cmdBackup_Click
End Sub
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim DataBE As String
DateNow = Now()
DataBE = CurrentDBDir & "PLOGBE.mdb"
DestinationFile = Me.txtFolderPath & "PLOG2005BE" & Format(DateNow,
"mmddyy") & ".bku"
Me.txtSource = DataBE
Me.txtDest = DestinationFile
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
-----------end code-----------
first it would not work (unless saveing to root drive) because I didn't have
the "\" before the file name. Now it will save to a folder only but not the
root drive. How do let the user save the file anywhere?
Breakdown of code below:
I have three txtBoxes (txtfolderPath, txtDest, & txtsource)...txtFolderPath
is selected using a function GetOpenFileName by Ken Getz. It grabs the drive
and folder corretl, but it's my code that is screwing things up (the code
below).
---------------start code---------
Option Compare Database
Option Explicit
Dim DateNow As String
Dim DestinationFile As String
Private Sub cmdBackup_Click()
On Error GoTo Err_cmdBackup_Click
DestinationFile = Me.txtFolderPath & "\PLOG2005BE" & Format(DateNow,
"mmddyy") & ".bku"
Me.txtDest = DestinationFile
FileCopy Me.txtSource, Me.txtDest
MsgBox "Backup Successful.", , "PackageLog 2005"
Exit_cmdBackup_Click:
Exit Sub
Err_cmdBackup_Click:
MsgBox Err.Description
Resume Exit_cmdBackup_Click
End Sub
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim DataBE As String
DateNow = Now()
DataBE = CurrentDBDir & "PLOGBE.mdb"
DestinationFile = Me.txtFolderPath & "PLOG2005BE" & Format(DateNow,
"mmddyy") & ".bku"
Me.txtSource = DataBE
Me.txtDest = DestinationFile
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
-----------end code-----------