[AccessD] Item Not Found In This Collection

Rocky Smolin rockysmolin at bchacc.com
Tue Jun 8 09:14:15 CDT 2010


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

www.e-z-mrp.com <http://www.e-z-mrp.com/> 

www.bchacc.com <http://www.bchacc.com/> 

 

 

 



More information about the AccessD mailing list