James O said:
Thanks very much for your responses I have tried to incorporate this
and have some problems. I will clarify. Here is what the table looks
like.There is more than 1 MIO value.
VendorCode Volume MIO
2515 1 NBCC
Ok The vendor codes range from 2000 to 9000. The count can be any
number. There are 7 different MIO's. NACC and NACW are the two that
give me trouble..... here is why. I pull a report showing these
fields and I am trying to accurately import into an access table. I
have a Import table that I put the initial data on. Then I append to
the main table adding a date and timestamp of time/date appended.
There can be more than one of the same vendor code. That is not a
problem accept with NACC NACW. On a report that I pull from this data
I count the total number of times a vendor code appears under one of
the MIO's on a given date and a sum of the Volume for each instance
of that VendorCode under the same MIO. So I Import this...
VendorCode Volume MIO
2515 2 NBCC
2515 2 NBCC
2516 2 NACC
2516 2 NACC
And Output this on the report.
VendorCode CountOfVendor Volume MIO
2515 2 4
NBCC 2516 2 4
NACC
On a much larger scale of course. My problem is with NACC and NACW. I
need to add NACW volumes to NACC records of the same vendor codes.
But NOT add the NACW vendor codes to the CountofVendor. AND not have
NACW on the report. So remove NACW from the report but add its volume
to the corresponding vendor codes and not add NACW vendor codes to
the CounfOfVendor. So what is better, do this during the append
process or using queries between the table and the report. I am going
to mess around with using multiple queries between the table and
report. I apologize for my previous post it was not detailed enough.
Thanks for all your help and have a great day!
James O'Donnell
If I understand you correctly, you want to add the Volume of NACW
entries to those of NACC entries, but otherwise act as though they
didn't exist -- don't count them, don't show them. If you were willing
to count them, you could just transform NACWs to NACCs on input, but the
requirement not to count them makes it more complicated.
One possible approach would be to do something like this:
SELECT
YourTable.VendorCode,
IIf([YourTable].[MIO]="NACW","NACC",[YourTable].[MIO])
AS MIO,
Sum(IIf(YourTable.MIO="NACW",0,1))
AS CountOfVendor,
Sum(YourTable.Volume) AS TotalVolume
FROM YourTable
GROUP BY
YourTable.VendorCode,
IIf([YourTable].[MIO]="NACW","NACC",[YourTable].[MIO]);