DoCmd.CopyObject problem (1 Viewer)

meenctg

Learn24bd
Local time
Today, 09:43
Joined
May 8, 2012
Messages
133
I have a main.mdb and backup.mdb in same directory. In main.mdb has a account table. I wanna copy account table to backup.mdb file with click event

I have use the function to retrieve the current db path. but it doesn't retrieve the currentdbpath with backup.mdb file.

Code:
Public Function GetDBPath() As String
    Dim strFullPath As String
    Dim I As Integer

    strFullPath = CurrentDb().Name

    For I = Len(strFullPath) To 1 Step -1
        If Mid(strFullPath, I, 1) = "\" Then
            GetDBPath = Left(strFullPath, I)
            Exit For
        End If
    Next
End Function

I have use Docmd.CopyObject
Code:
Private Sub Command4_Click()
DoCmd.CopyObject "[COLOR="Red"]how can call destination function[/COLOR]","account", acTable, "account"
end sub

how can use the destination path with CurrentdDbPath/backup.mdb.

anybody help me please?
 

Estuardo

Registered User.
Local time
Today, 03:43
Joined
May 27, 2003
Messages
134
Have you tried Application.CurrentProject.Path
 

Users who are viewing this thread

Top Bottom