santastefano
Programmer
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.
Can anybody advise?
Thanks in advance
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
Thanks in advance