Rocky Smolin
rockysmolin at bchacc.com
Tue Jun 8 10:10:42 CDT 2010
That was my first thought as well. But that field appears only in one table and I almost always cut and paste to avoid the typos. I tried Gustav's experiment and it worked (please see my post back to him) so the field is there and can be accessed. Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman Sent: Tuesday, June 08, 2010 7:58 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Item Not Found In This Collection Rocky, <<The Field fldPODRevision is in the table - I did a cut and poaste to avoid typos. All the other fields copy fine. When I comment out the line with the problem, the PO copies perfectly. >> You sure you looked in the right table or that your using the table with the field in it? Sounds to me like the field is either not there or mis-spelled. Jim. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Tuesday, June 08, 2010 10:49 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Item Not Found In This Collection Hi Rocky Will this return a record: Set rsPODetail = db.OpenRecordset("Select fldPODRevision FROM tblPODetail WHERE fldPOHID = " & Me.fldPOHID) Further, why not just open the table once: Set rsPODetailNew = db.OpenRecordset("Select * FROM tblPODetail WHERE fldPOHID = " & Me.fldPOHID) Set rsPODetail = rsPODetailNew.Clone /gustav >>> rockysmolin at bchacc.com 08-06-2010 16:14 >>> Dear List: I am cloning a purchase order, so I'm cycling through the PO detail lines, creating a new PO Detail record for each existing detail record. I've already copied the PO Header record and have the PK available. All's well until it comes to one specific field in the PODetail copy code and then I get the message 'Item Not Found In This Collection'. The code to copy is: rsPODetailNew.AddNew rsPODetailNew!fldPOHID = rsPOHeader!fldPOHID rsPODetailNew!fldPODLineNumber = rsPODetail!fldPODLineNumber rsPODetailNew!fldPODPartNumber = rsPODetail!fldPODPartNumber rsPODetailNew!fldPODVendorPart = rsPODetail!fldPODVendorPart rsPODetailNew!fldPODPartDescription = rsPODetail!fldPODPartDescription rsPODetailNew!fldPODUOM = rsPODetail!fldPODUOM rsPODetailNew!fldPODUnitCost = rsPODetail!fldPODUnitCost rsPODetailNew!fldPODDateRequired = rsPODetail!fldPODDateRequired rsPODetailNew!fldPODQuantityOrdered = rsPODetail!fldPODQuantityOrdered rsPODetailNew!fldPODQuantityReceived = rsPODetail!fldPODQuantityReceived rsPODetailNew!fldPODTaxable = rsPODetail!fldPODTaxable rsPODetailNew!fldPODPosted = rsPODetail!fldPODPosted rsPODetailNew!fldPODRevision = rsPODetail!fldPODRevision rsPODetailNew.Update and the offending line is rsPODetailNew!fldPODRevision = rsPODetail!fldPODRevision. Where fldPOHID is the FK to the Header. Both rsPODetailNew!fldPODRevision and rsPODetail!fldPODRevision show as not being in the collection when I hover over them with the pointer. So it's common to both recordsets. The two recordsets are opened thusly: Set rsPODetail = db.OpenRecordset("Select * FROM tblPODetail WHERE fldPOHID = " & Me.fldPOHID) Set rsPODetailNew = db.OpenRecordset("Select * FROM tblPODetail") where Me.fldPOHID is the PK of the PO to be copied. Very straightforward. The Field fldPODRevision is in the table - I did a cut and poaste to avoid typos. All the other fields copy fine. When I comment out the line with the problem, the PO copies perfectly. Usually this kind of intractable problem can be solved by writing out the description to the list and in the process I see where the error is and never send the email. In this case, here I am at the end of the post and still can't see why that one field should no be in the collection. Ay speculations welcome. MTIA Rocky Smolin Beach Access Software 858-259-4334 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com