Link to home
Start Free TrialLog in
Avatar of Rich
RichFlag for United States of America

asked on

Problems with recordsetClone

Hi
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.
samle4EE.accdb
Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

Previous question: https://www.experts-exchange.com/questions/27784684/Copy-data-from-one-subform-to-another-on-differnt-main-forms.html

I don't have version 2010 available at the moment. I'm sure another expert will be able to help.
(°v°)
Avatar of Rich

ASKER

Here it is in the mdb file format for anyone who can help
samle4EE.mdb
ASKER CERTIFIED SOLUTION
Avatar of Markus Fischer
Markus Fischer
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rich

ASKER

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.

Rich
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!
(°v°)