Hi
My job involves taking statistical samples from a range of data for audit examination, and I'm trying to program an access database to do this for me. I'll try to explain below what I need:
I have a query set up as follows:
SELECT a.ID, a.Year, a.Period, a.[Batch Ref], a.Date, a.Supplier, a.[Supplier Name], a.Reference, a.[Reference 3], a.Type, a.Gross, a.Discount, a.[Account Code], Sum(b.Gross) AS Total
FROM [qry Invoices] AS A INNER JOIN [qry Invoices] AS B ON A.ID>=B.ID
GROUP BY a.ID, a.Year, a.Period, a.[Batch Ref], a.Date, a.Supplier, a.[Supplier Name], a.Reference, a.[Reference 3], a.Type, a.Gross, a.Discount, a.[Account Code];
This gives the total population with a running total for Gross. I have a pre-set sampling interval and want to pick the records where the running total reaches the sampling interval, and then reset the running total to 0 and continue. The example below might clarify things:
(Assuming a sampling interval of £2000)
Inv.No Gross Total
12121 £1000 £1000
52525 £500 £1500
54511 £600 £2100 (therefore choose this item)
14141 £580 £580 (total resets to 0)
15455 £1100 £1680
54554 £200 £1880
44111 £250 £2130 (therefore choose this item)
74545 £540 £540 etc.
Is this possible? (I appreciate it may be more suited to a spreadheet, but I thought I'd try it in Access first)
AL
My job involves taking statistical samples from a range of data for audit examination, and I'm trying to program an access database to do this for me. I'll try to explain below what I need:
I have a query set up as follows:
SELECT a.ID, a.Year, a.Period, a.[Batch Ref], a.Date, a.Supplier, a.[Supplier Name], a.Reference, a.[Reference 3], a.Type, a.Gross, a.Discount, a.[Account Code], Sum(b.Gross) AS Total
FROM [qry Invoices] AS A INNER JOIN [qry Invoices] AS B ON A.ID>=B.ID
GROUP BY a.ID, a.Year, a.Period, a.[Batch Ref], a.Date, a.Supplier, a.[Supplier Name], a.Reference, a.[Reference 3], a.Type, a.Gross, a.Discount, a.[Account Code];
This gives the total population with a running total for Gross. I have a pre-set sampling interval and want to pick the records where the running total reaches the sampling interval, and then reset the running total to 0 and continue. The example below might clarify things:
(Assuming a sampling interval of £2000)
Inv.No Gross Total
12121 £1000 £1000
52525 £500 £1500
54511 £600 £2100 (therefore choose this item)
14141 £580 £580 (total resets to 0)
15455 £1100 £1680
54554 £200 £1880
44111 £250 £2130 (therefore choose this item)
74545 £540 £540 etc.
Is this possible? (I appreciate it may be more suited to a spreadheet, but I thought I'd try it in Access first)
AL