Db-why-not
Registered User.
- Local time
- Today, 16:10
- Joined
- Sep 17, 2019
- Messages
- 159
I am trying to automate the exporting of several tables and queries. I have a button that you click that executes this code. I keep getting error messages. I was wondering if there is anything else wrong with my code. Micro_results_q is actually a query but I want it to export as a table. Can I leave it like that? I have several more tables and querys I want to export but haven't added to the code yet.
Code:
Private Sub CommandTransfer_Click()
On Error GoTo SubError
strPath = "M:\Research\Lung US\Data\Exporting_OHSU\OHSU.mdb"
DoCmd.TransferDatabase acExport, "Microsoft Access", strPath, acTable, "Admission_DX", "Admission_DX", True
DoCmd.TransferDatabase acExport, "Microsoft Access", strPath, acTable, "Micro_Results_q", "Micro_Results_q", True
MsgBox "File Exported successfully", vbInformation + vbOKOnly, "Export Success"
SubExit:
Exit Sub
SubError:
MsgBox "Error Number: " & Err.Number & "= " & Err.Description, vbCritical + vbOKOnly, "An error occured"
GoTo SubExit
End Sub