Completely New to VB - Convert Macro Problems

bobquan

New member
Local time
Yesterday, 16:41
Joined
Jan 28, 2008
Messages
5
I am a seasoned access user but I am expanding my database nationally, the use of VB would be of great help. I converted a macro into VB and then added to it but it will not run. Here is the code. Please let me know what I am doing wrong it errors out immediately.

Option Compare Database
'------------------------------------------------------------
' Copy_Of_Build_Guidelines
'
'------------------------------------------------------------
Function Copy_Of_Build_Guidelines()
On Error Resume Next 'Skip over erros in system tables
DoCmd.RunSavedImportExport "C1"
DoCmd.RunSavedImportExport "C2"
DoCmd.RunSavedImportExport "C3"
DoCmd.RunSavedImportExport "C4"
DoCmd.RunSavedImportExport "C5"
DoCmd.RunSavedImportExport "C6"
DoCmd.RunSavedImportExport "C7"
DoCmd.RunSavedImportExport "C8"
DoCmd.RunSavedImportExport "C9"
DoCmd.RunSavedImportExport "C10"

Copy_Of_Build_Guidelines_Exit:
Exit Function
Copy_Of_Build_Guidelines_Err:
MsgBox Error$
Resume Copy_Of_Build_Guidelines_Exit
End Function
 
Comment out the On Error Resume Next part (not a good method anyway as you'll never know if there is an error). Then run it and see where it errors out.
 
Thanks for the direction

it errors out instantly at:

Copy_Of_Build_Guidelines_Err:
MsgBox Error$
Resume Copy_Of_Build_Guidelines_Exit


with Error$ highlighted
 
It says Compile Error
can't find project or library
 
Thanks for the direction

it errors out instantly at:

Copy_Of_Build_Guidelines_Err:
MsgBox Error$
Resume Copy_Of_Build_Guidelines_Exit


with Error$ highlighted

change Error$ to

MsgBox Err.Description

If you are wanting the error description. I've not seen Error$ being used before.
 
Make sure that you do not have any "MISSING" references.
 
DoCmd.RunSavedImportExport "C1"

not checked, but is that really an argument of docmd object?
 

Users who are viewing this thread

Back
Top Bottom