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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

user defines type not defined 1

Status
Not open for further replies.

santastefano

Programmer
Aug 9, 2005
54
IT
The following code has worked well but has now stopped with the error message "user defined type not defined" at the line Dim rsNewBook As DAO.Recordset. I can not understand why it has stopped.
Code:
Dim varBookTitle, varPublisher, varSupplier, varBuyPrice, varSellPrice, varMOQ As Variant
varBookTitle = Me.BookTitle
varPublisher = Me.Publisher
varSupplier = Me.Supplier
varBuyPrice = Me.BuyPrice
varSellPrice = Me.SellPrice
varMOQ = Me.MOQ
Dim rsNewBook As DAO.Recordset
    Set db = CurrentDb
    Set rsNewBook = db.OpenRecordset("tblBooks", dbopendynaset)
   With rsNewBook
      .AddNew   
      !BookTitle = varBookTitle
      !Publisher = varPublisher
      !Supplier = varSupplier
      !BuyPrice = varBuyPrice
      !SellPrice = varSellPrice
      !MOQ = varMOQ
      .Update   
    End With
rsNewBook.Close 
Set rsNewBook = Nothing 
Set db = Nothing
Can anybody advise?
Thanks in advance
 
when in VBE (Ctrl+G) menu Tools -> References ...
Tick the Microsoft DAO 3.# library.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks easyit.
References are Ok.
I am sorry to be Mr Thicko but I don't understand Unlink and Relink.
When you have time could you please point me...
Thanks in advance
 
PHV - a good fix. I am not sure how it could have got unchecked but, never mind. It works OK now.
Thanks for reading and responding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top