HELP Compile Error opening db

  • Thread starter Thread starter maryanne
  • Start date Start date
M

maryanne

We are trying to move an access 97 db to the new computer
we just purchased (the only Office program on the new
computer is Access 97). The db is no longer supported by
the agency we got it from.
The db works fine on the old computer, but when we try to
open it on the new one, we get a compile error - can't
find project or library" I've copied the registration db
along with this db and set the paths to be the same on the
new computer, but I'm still getting this error.
The code is highlighted within a function to register the
db called Function CheckReg().The highlighting is at the
line that says "rst databasename = right$" as in:
Else
On Error GoTo exit_link
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("tblregistration")
If rst.recordcount > 0 Then
If Not IsNull(rst!SiteReg) Then
DoCmd.Close acForm, "pleasewait"
On Error GoTo exit_link3
rst.Edit
rst!DatabaseName = right$(CurrentDb.NAME, Len
(CurrentDb.NAME) - ap_LastInStr(CurrentDb.NAME, "\"))
rst!DatabasePath = left$(CurrentDb.NAME, Len
(CurrentDb.NAME) - Len(rst!DatabaseName))
rst.update
Call CompileCode
Application.Echo True, "Welcome to OSHMAP...."
DoCmd.Hourglass False
Exit Function
End If
 
We are trying to move an access 97 db to the new computer
we just purchased (the only Office program on the new
computer is Access 97). The db is no longer supported by
the agency we got it from.
The db works fine on the old computer, but when we try to
open it on the new one, we get a compile error - can't
find project or library" I've copied the registration db
along with this db and set the paths to be the same on the
new computer, but I'm still getting this error.
The code is highlighted within a function to register the
db called Function CheckReg().The highlighting is at the
line that says "rst databasename = right$" as in:
Else
On Error GoTo exit_link
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("tblregistration")
If rst.recordcount > 0 Then
If Not IsNull(rst!SiteReg) Then
DoCmd.Close acForm, "pleasewait"
On Error GoTo exit_link3
rst.Edit
rst!DatabaseName = right$(CurrentDb.NAME, Len
(CurrentDb.NAME) - ap_LastInStr(CurrentDb.NAME, "\"))
rst!DatabasePath = left$(CurrentDb.NAME, Len
(CurrentDb.NAME) - Len(rst!DatabaseName))
rst.update
Call CompileCode
Application.Echo True, "Welcome to OSHMAP...."
DoCmd.Hourglass False
Exit Function
End If

That PC has a missing reference.
Open any module in Design view (or click Ctrl + G).
On the Tools menu, click References.
Click to clear the check box for the type library or object library
marked as "Missing:."

An alternative to removing the reference is to restore the referenced
file to the path specified in the References dialog box. If the
referenced file is in a new location, clear the "Missing:" reference
and create a new reference to the file in its new folder.

See Microsoft KnowledgeBase articles:
283115 'ACC2002: References That You Must Set When You Work with
Microsoft Access'
Or for Access 97:
175484 'References to Set When Working With Microsoft Access' for
the correct ones needed,
and
160870 'VBA Functions Break in Database with Missing References' for
how to reset a missing one.

For even more information, see
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html
 
Thanks - I'll give it a try next week when I'm up at the
other office with that computer.
 
Back
Top