Compile Error message!

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Group
When I try to run the code below I get a "Compiler error: User-defined
type not defined" the compiler highlight the "Dim rst As DAO.Recordset"
portion of the code.

Private Sub cmdSubmit_Click()
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblUserNameBothNetworkAndFriendly")
rst.Index = "PrimaryKey"
rst.AddNew
rst!strUserNetworkName = fOSUserName
rst!strComputerNetworkName = fOSMachineName
rst!strUserFirstName = txtFirstName
rst!strUserLastName = txtLastName
rst.Update
End Sub

Any ideas the book I'm using is "ACCESS 2002 VBA Handbook" from Novalis and
Jones. I see this DAO in every example of modifying or adding a record to a
table. The example that i'm modeling this from is found on page 777 on the
bottom of the page the title of the page is "Adding a Record"

Thanks Mike Sundman

mike(dot)sundman(at)ctd1.com
 
im guessing when you type DOA. that the compiler isnt
poping a list of members of DOA?

in any case i would definitly try ommiting the DOA. portion
you should definitly be able to declare a variable of type
Recordset

if that doesn't work then from any code window choose
Tools->References... from the menu

look for any entries that are marked MISSING
especially look for an entry named Microsoft DAO #.##
Object Library

if it is in the list, but unchecked, check it

hope this helps
 
Mike,

Based on the line on which the error occurs, I believe you may be missing a
Reference to Microsoft DAO 3.6 Object Library. Access 2002 does not set
this reference by default in databases.

hth,
 
Back
Top