Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile problems Access97

Status
Not open for further replies.

GLENEE

Programmer
Feb 9, 2005
64
GB
The problem is when I try to compile or compact in 97 I get the following error message

compile error:
"Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic"

It highlights set db = currentDB()in a number of modules.

I have both Access 97 and Access 2003 running on a laptop. I've ckecked that the reference for Microsoft DAO 3.6 Object Library is available and is as high a priority as possible. Not sure what else to do?
 
How did you declare the db? Try using Dim DB as DAO.Database if not already.
 
The reference Microsoft DAO 3.6 Object Library is ticked and 3rd in the list behind Visual Basic for Applications and Microsoft Access 8.0 Object Library
 
Have you set any other references?

Sometimes microsoft uses the same name for different versions of an .ocx file (common dialog or rich text box are examples) and that can give an error that is not related to what debug shows as the error.

How about showing the code up to the point it errors.
 

Private Sub Form_Load()
On Error GoTo Err_Form_Load

Dim db As Database
Dim rst As Recordset
2 other references have been set besides the other ones previously stated:
Microsoft ActiveXData Objects 2.8 Library and OLE Automation

Sample code where error occurs is as follows:
Dim db as Database
Dim rst as Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Tbl_AttributeRemove")
If rst.Fields(1) = 1 Then
DoCmd.OpenForm "Frm_Attribute"
End If
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
 
Tru uncecking, the rechecking the DAO library. As stated by bubba100, be explicit in your declarations
[tt]dim db as dao.database
dim rs as dao.recordset[/tt]

Would you by any chance have anythying called currentdb anywhere? Try

[tt]set db = application.currentdb[/tt]

ore use

[tt]set db = dbengine(0)(0)[/tt]

else - could it be some corruption?

Roy-Vidar
 
Change to:

Dim db as DAO.Database
Dim rst as DAO.Recordset

if you have any tabledefs or querydefs change those also.
 
Tried both previous replies, still causing error. I suspect its probably the fact that I have both 97 and 2003 versions of access installed on the same laptop and it is causing some kind of corruption. Thanks for your help anyway.
 
If you can't find Microsoft DAO 3.51 Object Library in your 97 version, I would guess that the installation is probably corrupt, and need to be reinstalled.

I wouldn't be surprised if such might be due to how you have installed this initially. I think there are some issues when having more than one version on the same PC (which I've never dared).

Roy-Vidar
 
Sounds like you need to reinstall Access 97..


Uninstall Office 2003

Uninstall Office / Access 97

Reboot (better to be paranoid than wrong)

Install Office / Access 97

Reboot (better to be paranoid than wrong)

Install Office 2003 ensuring not to uninstall office 97 programs you want to keep and not in the same directory as office 97 <Change the default>.


That ought to do it. I normally install each version office in a subfolder for the same version. However I also have seen a machine go to hell because someone reinstalled Office 97 in a different directory. Rather than figuring it out, I formatted the machine. Works great now :)
 
It has sort of been covered but I wanted to put in the three standard references for Access 97... In the order they appear on my installation:

Visual Basic For Applications
Microsoft Access 8.0 Object Library
Microsoft DAO 3.51 Object Library
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top