
Random Automation Errors with Dim variable
Quote:
> 2 days ago a made a bunch of forms that have subfoms with unbound controls
> based on queries referring to contols on the parent. They worked fine when
> I left for the day. Now I'm suddenly getting "Complie Error: Automation
> Error". The help is no help and I wasn't even aware I was using automation
> for anything. Here is the code:
> Sub IDB_ASSIGN_Click()
> On Error GoTo Err_IDB_ASSIGN_Click
> Dim dbs As Database, rst As Recordset '////////////////////////THIS IS
> WHERE THE ERROR OCCURS
> Set dbs = CurrentDb()
> Set rst = dbs.OpenRecordset("Attributes-WrapObjParts")
> rst.AddNew
> rst![Wrap Object ID] = Parent![Wrap Object ID]
> rst![Standard Part ID] = Me![IDL_AVAILABLE]
> rst.Update
> rst.Close
> Me![IDL_ASSIGNED].Requery
> Exit_IDB_ASSIGN_Click:
> Exit Sub
> Err_IDB_ASSIGN_Click:
> MsgBox Err.Description
> Resume Exit_IDB_ASSIGN_Click
> End Sub
> Any Clues? Am I missing something obvious. Have I had too much Diet Coke?
> Please Help
> Alley
This a REALLY annoying problem that I've had twice now. The problem is
100% irrational. DAO object types should not suddenly become
unrecognized by the compiler. The only solution that worked for me was
to create a new database and import all the objects from the old
database. Whatever corruption was causing the anomolous problem did not
reside in the object definitions, because my code compiled successfully
after that.
Try reinstalling Access if that doesn't work.
-Brandon Fogel