Upgrade from Access 2000 to 2003, MsgBox Error$ not working

G

Guest

Hi. I upgraded my Access 2000 to Access 2003 but my database is not working
correctly anymore. When I try to use .mdb, Access throws Microsot Visual
Basic errormessage stating: "Compile error: Can't find project or library".
Debugger stops in line MsgBox Error$ two times in following form code:

Sub Form_Load()
On Error GoTo Form_Load_Err

If ParentFormIsOpen() Then ......


Form_Load_Exit:
Exit Sub

Form_Load_Err:
MsgBox Error$ <--- Debugger stops 1st time here stating Error$ can't
be found
Resume Form_Load_Exit

End Sub
Sub Form_Unload(Cancel As Integer)
On Error GoTo Form_Unload_Err

If ParentFormIsOpen() Then .........


Form_Unload_Exit:
Exit Sub

Form_Unload_Err:
MsgBox Error$ <-------- 2nd time here
Resume Form_Unload_Exit

End Sub

Please help with this! Should I replace Error$:s with something? I'm not
experienced Access form coder so this might be easy problem for you...

Thanks already
- Timo
 
B

Brendan Reynolds

Error$ is old Access 2 syntax, but it is still supported for backward
compatibility - it works fine for me in Access 2003. I suspect you have a
missing or mismatched reference. In the VBA editor, select 'References' from
the 'Tools' menu. Are any of the checked references marked 'MISSING'?
 
D

Douglas J. Steele

Even if Brendan's suggestion of checking the References solves the problem,
you really should be use Err.Description rather than Error$.
 
B

Brendan Reynolds

I agree. But I think it may be best to delay making that change until
*after* determining whether the problem is a missing or mismatched
reference. Changing Error$ to Err.Description without first determining
whether there is a problem with the references might hide the problem only
to have it resurface later - in the same way that Now() sometimes works when
Date() fails because of a reference problem.
 
G

Guest

There were no MISSING:s in reference; replacing all Error$:s from the
projects with Err.Description:s worked and solved the problem!

Thanks a lot!

- Timo Haavisto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top