Hi all,
I have a situation that has me puzzled, and I'd like to see if anyone has any suggestions.
I have an Access database that runs daily, and periodically needs to archive certain tables. I'm trying to write the vba code to do so, but I'm getting Run-time error 2507 - "The type isn't an installed database type or doesn't support the operation you chose"
My code is below. I'm using DoCmd.TransferDatabase, and that is the command that is giving the error. I've tried acTable (as shown in the code below), acDefault, and leaving it blank. Is there a reference that's needed for this that may be lacking? Both the source and destination databases have Microsoft Access 14.0 Object Library referenced. I appreciate any suggestions.
I have a situation that has me puzzled, and I'd like to see if anyone has any suggestions.
I have an Access database that runs daily, and periodically needs to archive certain tables. I'm trying to write the vba code to do so, but I'm getting Run-time error 2507 - "The type isn't an installed database type or doesn't support the operation you chose"
My code is below. I'm using DoCmd.TransferDatabase, and that is the command that is giving the error. I've tried acTable (as shown in the code below), acDefault, and leaving it blank. Is there a reference that's needed for this that may be lacking? Both the source and destination databases have Microsoft Access 14.0 Object Library referenced. I appreciate any suggestions.
Code:
Dim strDay, strMonth, strYear As String
Dim strRPT141DatabaseSourcePath, strRPT141DatabaseDestinationPath As String
Dim strRPT141FolderPath As String
Dim strRPT141TableName As String
If ggStrPreviousBusinessDate = "" Then
Call GetPreviousBusinessDate
End If
strDay = Right("0" & Day(ggStrPreviousBusinessDate), 2)
strMonth = Right("0" & Month(ggStrPreviousBusinessDate), 2)
strYear = Year(ggStrPreviousBusinessDate)
'Check to see if the current month's RPT141 folder exists
strRPT141FolderPath = "[URL="file://\\coltrane\Margins\Daily"]Z:\Margins\Daily[/URL] Runs\RPT141_" & strYear & "-" & strMonth
If Len(Dir(strRPT141FolderPath, vbDirectory)) = 0 Then
MkDir strRPT141FolderPath
End If
'Check to see if the current month's RPT141 Access Database archive exists
strRPT141DatabaseDestinationPath = strRPT141FolderPath & "\RPT141_" & strYear & "-" & strMonth & "-" & strDay & ".accdb"
If Len(Dir(strRPT141DatabaseDestinationPath)) = 0 Then
strRPT141DatabaseSourcePath = "Z:[URL="file://\\Margins\Daily"]\Margins\Daily[/URL] Runs\RPT141-Template.accdb"
FileCopy strRPT141DatabaseSourcePath, strRPT141DatabaseDestinationPath
End If
'Export the current RPT141 tables into the current month's RPT141 Access Database archive
strRPT141TableName = "tblRPT093_" & strYear & strMonth & strDay
DoCmd.TransferDatabase acExport, , strRPT141DatabaseDestinationPath, acTable, "tblRPT093", strRPT141TableName
Last edited: