compile errors on dbs DIM statement....any ideas

paulmcdonnell

Ready to Help
Local time
Today, 12:37
Joined
Apr 11, 2001
Messages
167
Hi guys,


I have code which I use to update a set of records. The code used to work fine previously but now I'm getting "Compile error, Automation error" and my DIM dbs As Database statement highlighted by the de-bugger. Do i have a referencing probelem or is it something else. the code has worked fine before.

EG of Code:

Dim dbs As Database
Dim rst As Recordset
Dim retvalue As String
' collect seletion
Me.FilterOn = False
'check validity

' make changes
On Error Resume Next
retvalue = MsgBox("Make changes to fields", vbOKCancel + vbQuestion)
If retvalue = vbOK Then GoTo change Else End
change:
DoCmd.OpenForm ("Form-processing")

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(rsource)
rst.MoveFirst

Cheers
Paul
 
The library that you are missing is (for Access97) Microsoft DAO 3.51 Object Library
 
Harry,
I have that reference checked...

could it be something else???


cheers
Paul
 
At the risk of being expelled from this forum, may I give a simple but probably misguided suggestion:
Would it change things if you put a colon next to your label in the GoTo statement (e.g. "then goto LABEL:" rather than "then goto LABEL".)... Perhaps the highlighted statement is a red herring?

Marko

[This message has been edited by Marko Stojovic (edited 02-05-2002).]
 
I suspect you are right in guessing it's a reference problem. I recall reading that the DAO refence needs to be at the top of the loading list. You could also try adding another reference (any reference), compile, remove the added reference and compile again. You could also Dim your database and recordset as DAO.Database, DAO.recordset.
Good luck.
 

Users who are viewing this thread

Back
Top Bottom