
User-defined type not defined (Access 2000)
These types are defined in the DAO object library. By default, the DAO
object library is not referenced in an Access 2000 database (ADO is
instead). To solve the problem:
1. In the Microsoft Visual Basic window, choose References from the Tools
menu.
2. In the list of available references, check "Microsoft DAO 3.6 Object
Library".
3. Use the Priority buttons to move the entry for "Microsoft DAO 3.6 Object
Library" above the entry for "Microsoft ActiveX Data Objects 2.1 Library".
This is to resolve conflicts between types in DAO and ADO (like Field) that
have the same name. You can also avoid these conflicts by qualifying your
variable declarations, as in:
Dim fld As DAO.Field
instead of
Dim fld As Field
4. Click OK.
Quote:
> I can run this code in Access 97 with no problems, but
> when we use this same code in an Access 2000 form I get an
> error stating "User-defined type not defined" and the area
> highlight is "dbs as database". What is wrong with this?
> I am new to Access 2000, I havespent my time with Access
> 97.
> The code:
> Dim DBS As Database
> Dim RST As Recordset
> Dim x, y
> Set DBS = CurrentDb()
> Set RST = DBS.OpenRecordset("temp_table")
> DoCmd.SetWarnings False
> 'MsgBox RST.RecordCount
> RST.MoveFirst
> y = 0
> While Not RST.EOF
> x = RST!tempcount
> DoCmd.RunSQL "UPDATE temp_table SET t1 = " & y & "
> WHERE tempcount = " & x & ";"
> y = y + 0.5
> RST.MoveNext
> Wend
> DoCmd.SetWarnings True
> Thanks for the help.
> -Mike