Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer 24 Lessons    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
User Defined Type Not Defined Lesson 3
Sarah Bliss 
     
4 months ago
I get the above error message.
I copied your recordset code exactly. I changed the table names and the field names but left the whole thing as it was.
But it doesn't even get beyond the second line. It an't find the "Dim rsNew as recordset". I alternated it with the "rsOld" bit but same problem.
This is the very first time I've tried using recordsets. Is there sone setting I should have? What am I doing wrong?
I tried to add a screenshot here but I don't know how to.
Kevin Robertson  @Reply  
          
4 months ago
You have a missing reference. In the VB Editor go to Tools -- References.
Make sure Microsoft Office 16.0 Object Library is checked.
Sarah Bliss OP  @Reply  
     
4 months ago
Thank you Kevin. It wasn't checked and I checked it. I did a compact & repain and closed the database and opened it again but I get the same error.

This is the code but it hasn't even got to the point of starting because of this initial error:

DetailsPrivate Sub AddRecipeCopyBtn_Click()

        Dim NewID As Long, ProductID As Long
        Dim rsNew As Recordset, rsOld As Recordset
        Dim Fld As Field

    If IsNull(RecipeID) Then Exit Sub
    Me.Refresh
    
    ProductID = ProductNameCombo
    
    ' copy the recipe
    Set rsOld = CurrentDb.OpenRecordset("SELECT * FROM RecipeT WHERE RecipeID=" & RecipeID)
    Set rsNew = CurrentDb.OpenRecordset("RecipeT")
    rsNew.AddNew
    NewID = rsNew!RecipeID
    For Each Fld In rsOld.Fields
        If Fld.Name = "RecipeDate" Then
            rsNew!RecipeDate = Date
        ElseIf Fld.Name = "RecipeNotes" Then
            rsNew!RecipeNotes = "(COPY) " & rsOld!RecipeNotes
        ElseIf Fld.Name <> "RecipeID" Then
            rsNew(Fld.Name) = rsOld(Fld.Name)
        End If
    Next
    rsNew.Update
    rsNew.Close
    rsOld.Close
Sarah Bliss OP  @Reply  
     
4 months ago
I went looking at thoses references and I googled them and found this:
     "Microsoft ActiveX Data Objects Recordset 6.0 Library"
I tried it and the error stopped.
I now have another error (LOL) but it's in the SQL bit so it's probably spelling or something.
Let me know if this is something I shouldn't have done - it's way out of my depth here.
And thanks again - and on Sunday too! Thank you!
Kevin Robertson  @Reply  
          
4 months ago
Sarah Bliss OP  @Reply  
     
4 months ago
Right under my nose🤣🤣🤣

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 24 Lessons.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/14/2026 5:34:57 AM. PLT: 1s