View Single Post
  #7  
Old August 25th, 2009, 09:49 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default Archived records copying multiple times

Just to confirm, if you run this query it only returns one record

SELECT tbl_InventoryListing.ID, tbl_InventoryListing.ADJTrans,
tbl_InventoryListing.DRMOTrans, tbl_InventoryListing.RECTrans,
tbl_InventoryListing.SHPTrans, tbl_InventoryListing.ReceivedDate,
tbl_InventoryListing.ReceiptDoc, tbl_InventoryListing.TransactionDate,
tbl_InventoryListing.QtyOnHand, tbl_InventoryListing.UpdatedQty,
tbl_InventoryListing.UnitofIssue, tbl_InventoryListing.PartNo,
tbl_InventoryListing.CageCode, tbl_InventoryListing.SupplySource,
tbl_InventoryListing.NIIN, tbl_InventoryListing.UnitCost,
tbl_InventoryListing.Serial, tbl_InventoryListing.Index,
tbl_InventoryListing.ConditionCode, tbl_InventoryListing.Program,
tbl_InventoryListing.Division, tbl_InventoryListing.Purpose,
tbl_InventoryListing.EMR, tbl_InventoryListing.Requisition,
tbl_InventoryListing.Remarks, tbl_InventoryListing.DateModified,
tbl_InventoryListing.EnteredBy, tbl_InventoryListing.ShippingPriority,
tbl_InventoryListing.DestinationUIC, tbl_InventoryListing.ShippingMethod,
tbl_InventoryListing.TrackingNumber, tbl_InventoryListing.NHA,
tbl_InventoryListing.Archive
FROM tbl_InventoryListing
WHERE (((tbl_InventoryListing.NHA)=Yes)) OR
(((tbl_InventoryListing.Archive)=Yes));

Is that right?

As far as the macro goes, it should run the queries one time when you execute
the macro. One problem is that if you have an error occur then you won't know
about it and you should have at least another SetWarnings call to turn warning
back on.

One problem I can guess at is that it is possible that qapp_HistoryDelete is
not cleaning up the way you think it is and you are appending the same records
over and over into tbl_history.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Deb wrote:
Here is the deal. On my computers, the program works fine. However, on the
client's system, I split the database (tables separated from program). Don't
know if that has anything to do with the issue or not.

I went to the client's office this morning, and selected a record to copy to
the archive table. The message box came up and indicated that 10 records
would be copied to the archive table. I checked the archive table, and every
record in there was duplicated at least once, most were duplicated three,
four and five times.

You've seen the query to copy the records into the archive file. I
developed a macro (very simple macro) which runs the query to copy the
records and another query to delete the records from the inventory table.

Breakdown of the macro:

Hourglass
SetWarnings
Echo
OpenQuery - qapp_HistoryQuery
OpenQuery - qapp_HistoryDelete
MsgBox - Records archived to History File

I know very little about macros - but don't know if that's the problem or not.