Private Sub CmdExportRecords_Click()
On Error GoTo cmdTrustedLocation_Err
Me.FileList.SetFocus
DoCmd.Hourglass True
'Turns off the Access warning messages
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryExportLatestStudentRecords"
DoCmd.OpenQuery "qryExportLatestUniversityApplications"
DoCmd.TransferDatabase acExport, "Microsoft Access", _
Me.FileList, _
acTable, "tblExportLatestStudentRecords", "tblExportedLatestStudentRecords"
DoCmd.TransferDatabase acExport, "Microsoft Access", _
Me.FileList, _
acTable, "tblExportLatestUniversityApplications", "tblExportedLatestUniversityApplications"
MsgBox ("Records Copied and Exported: " & DCount("ID", "tblExportLatestStudentRecords")), vbInformation, "PFL Export Student Records"
DoCmd.Hourglass False
'Turns the Access warning messages back on
DoCmd.SetWarnings True
cmdTrustedLocation_Err:
DoCmd.Hourglass False
'Turns the Access warning messages back on
DoCmd.SetWarnings True
If Err.Number = 2001 Then
Msg = "You clicked the CANCEL Button when a security notice was displayed." & vbCrLf & _
"The Security Notice message was displayed because you have not added the database directory name to the TRUSTED LOCATIONS area." & vbCrLf & _
"Please add the database name and try the export procedure again."
MsgBox Msg, vbExclamation + vbOKOnly, "Export Procedure - Security Warning Notice"
End If
End Sub
|