Avatar of Rich
Flag for United States of America asked on

Problems with recordsetClone

I am having an issue when I am using RecordsetClone object to create a new record and then display it on a form. The issue is that even though the RecordsetClone object gets correctly filled in with data from a previous form in the current form onLoad event method, and the resulting record is stored in the database, when the new form is display, incorrect record data is displayed.

I am attaching a sample Access 2010 database.

Use the frmNavigation to start, and then open a Quote - this is frmQuote. At the bottom of the Quote is a button that says "Create Booking". This button opens the frmBooking form and runs code to create RecordsetClones of the data. Data is taken from a main table quotes and two subform tables quoteBilling and quoteMerchandise.
The new form is a view of the Booking table and the Quote and subtables are copied to the corresponding Booking and bookingBilling and bookingMerchandise tables. This new record should then be displayed on the frmBooking. The problem is that the data displayed on the frmBooking form is from an incorrect record, not the one just created.
Microsoft Access

Avatar of undefined
Last Comment

8/22/2022 - Mon

Previous question: https://www.experts-exchange.com/Q_27784684.html

I don't have version 2010 available at the moment. I'm sure another expert will be able to help.

Here it is in the mdb file format for anyone who can help

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Yes, this makes a difference and your code updates appear to work for me. I will have to figure out what you did that make the difference, but am happy to be past this roadblock for me.

As a bit of background, this is the first Access project I have had to deal with, and am learning quickly with your help. I was asked to update this old program that was no longer supported under Windows 7 and Access 2010 (many 3 rd party application libraries were used that are not available under new OS and app environment). At your urging, I now have the code compiling with no errors as you recommend, but will have to decide what to do with the referential integrity as I go forward as there are in actuality 20k plus records in each of the DB tables - maybe I can remove the bulk of them.

Again, I thank you for your valuable input and will hopefully make much more progress on my own from this point forward as I attempt to understand your initial critiques.

Your help has saved me hundreds of hours of internet surfing.

Not critiques. I was meant as advice to avoid problems down the road. I did notice some typos in your code, which can be easily avoided by using “Option Explicit”. Why waste time chasing typos when VB can find them (at least most of them) for you?

« I will have to figure out what you did »

Basically: 1) made sure the booking form was on a new record, and not on an existing record; 2) finished creating the booking record and saved it before creating the linked records; and 3) removed the final portion of the Sub which was looping through all quotes, not just the current quote.

Thanks for the feedback, and success with your project!