Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2005

Tip: Looking for answers? Try searching our database.

Copy backend db in run mode. - Re-post

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James - 13 Jan 2005 23:47 GMT
I have a form that makes a copy of the backend database.  The code is below.  
However it works fine when I open the database with the shift key, but when
it is open in run mode (not .mde) it gives be an error box that says
"Permission Denied".  This is in Access 2000.  Anyone know how to fix this
problem.

--------------start code-----------------
Private Sub cmdBackup_Click()
On Error GoTo Err_cmdBackup_Click

   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 cmdBuildFile_Click()
Dim strFolder As String
  strFolder = BrowseFolder("Please select a new folder for the backup file.")
  If Not strFolder = vbNullString Then
     Me.txtFolderPath = strFolder
  End If
End Sub

Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click

   DoCmd.Close

Exit_cmdExit_Click:
   Exit Sub
   
Err_cmdExit_Click:
   MsgBox Err.Description
   Resume Exit_cmdExit_Click

End Sub

Private Sub Form_Load()
On Error GoTo Err_Form_Load
   Dim DataBE, DestinationFile
   Dim datenow
   
   datenow = Now()
   DataBE = CurrentDBDir & "PLOG2005BE.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

Private Sub txtFolderPath_BeforeUpdate(Cancel As Integer)
txtDest.Requery
End Sub
----------------End Code---------------
Wayne Morgan - 14 Jan 2005 11:54 GMT
FileCopy won't copy open files. I suspect that this form isn't your Startup
form. When you open the database using the shift key, you prevent your
startup form from opening. If you then open this form, the FileCopy works. I
would guess that the startup form is connected to a table in the back-end
file, causing Access to open the back-end file and prevent FileCopy from
working.

Signature

Wayne Morgan
MS Access MVP

>I have a form that makes a copy of the backend database.  The code is
>below.
[quoted text clipped - 69 lines]
> End Sub
> ----------------End Code---------------
James - 14 Jan 2005 19:51 GMT
Thank you.  The switchboard table was on the back-end, so I moved it to the
front and that worked.

> FileCopy won't copy open files. I suspect that this form isn't your Startup
> form. When you open the database using the shift key, you prevent your
[quoted text clipped - 76 lines]
> > End Sub
> > ----------------End Code---------------
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.