I have 2 different databases:
1 Master Data
2 Data Backup
Please help to create a VBA command button to copy the result of the search in database called "Master Data" to Table called "BackupData" in another database called "Data Backup". See photos
I use below VBA to deleted olddata after backup has been made to BackupData
Code:
Private Sub DeleteOlddata()
Dim strPasswd
Dim stDocName As String
Dim stLinkCriteria As String
On Error GoTo Err_Command6_Click_Error
strPasswd = InputBox("Enter Password", "Restricted Form")
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
End If
If strPasswd = "12345" Then
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdDelete
Else
MsgBox "Sorry, you do not have access to this form", vbOKOnly, _
"Important Information"
Exit Sub
End If
Exit_ErrorHandler:
Exit Sub
Err_Command6_Click_Error:
If Err.Number = 2501 Then
MsgBox "Delete action cancelled"
Resume Exit_ErrorHandler
Else
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure Command6_Click of VBA Document Form_T2 at Line " & Erl
Resume Exit_ErrorHandler
End If
End Sub
thanks in advance