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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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'?
 
Even if Brendan's suggestion of checking the References solves the problem,
you really should be use Err.Description rather than Error$.
 
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.
 
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
 
Back
Top