Graham T
Registered User.
- Local time
- Today, 07:57
- Joined
- Mar 14, 2001
- Messages
- 300
I have created a simple database to import information into a single table, from databases that are sent into us from students.
To begin with I had created a macro to do this option, but now see the need to include better error handling, as if mistakes are made, the admin people who will use this may have problems.
Basically, they will copy the Job_Search.mdb to the drive where the master database is held.
What I would like to include is the IF statement to check that this database (Job_Search.mdb) is present before the import starts, and if not to exit the routine.
Below is what I have from converting the macro, and would appreiciate help in including this statement as I am unsure as how to code the part that looks to see if the database has actually been copied to the correct drive:
TIA
Graham
To begin with I had created a macro to do this option, but now see the need to include better error handling, as if mistakes are made, the admin people who will use this may have problems.
Basically, they will copy the Job_Search.mdb to the drive where the master database is held.
What I would like to include is the IF statement to check that this database (Job_Search.mdb) is present before the import starts, and if not to exit the routine.
Below is what I have from converting the macro, and would appreiciate help in including this statement as I am unsure as how to code the part that looks to see if the database has actually been copied to the correct drive:
Code:
'------------------------------------------------------------
' mcrImport_Append_Delete
'
'------------------------------------------------------------
Function mcrImport_Append_Delete()
On Error GoTo mcrImport_Append_Delete_Err
DoCmd.Echo False, ""
DoCmd.TransferDatabase acImport, "Microsoft Access", "\\Dilbert\Data\Recruitment\Students\2002_Master_Employer_Database\Job_Search.mdb", acTable, "Employers", "Employers", False
DoCmd.SetWarnings False
DoCmd.OpenQuery "qry_Append_Student_To_Master", acNormal, acEdit
DoCmd.SetWarnings True
DoCmd.DeleteObject acTable, "Employers1"
Call Delete_Database
Beep
MsgBox "Data Import Complete. Student Database has been deleted from the drive.", vbInformation, "Master Employer Database"
mcrImport_Append_Delete_Exit:
Exit Function
mcrImport_Append_Delete_Err:
MsgBox Error$
Resume mcrImport_Append_Delete_Exit
End Function
TIA
Graham