I am a beginner with ms access 2003 and have recently been playing with access because it can hold more records than excel.
I have the following in a table:
DATE CUST# TRANSTYPE DESCRIP QTY COST
1/1/08 12345 B PRE-PAID SALE 10 $50.00
1/2/08 12345 C SERVICE USE -1 $0.00
1/3/08 12345 C SERVICE USE -1 $0.00
I would like to create a query to have the following results:
same as on top with [DATE] and [CUST#] but add...
TRANSTYPE DESCRIP QTY COST CHARGE BALANCE
B PRE-PAID SALE 10 $50.00 0.00 $50.00
C SERVICE USE -1 $0.00 -$5.00 $45.00
C SERVICE USE -1 $0.00 -$5.00 $45.00
It's easy to create a field for the balance: IIF([TRANSTYPE] = "B", [tbl].[COST],[tbl].[BALANCE]+ [CHARGE])...The problem I'm having is to create an expression/function that will calculate/populate the CHARGE table for me. Each pre-paid sale is at a different cost and basically the [CHARGE] field which I want to be ([COST]/[QTY] for the first row that has [TRANSTYPE] = "B".
Is this even possible with the current functions of access or do I need to create a custom VBA code. The other catch if...it is even possible is that there is an expiration date on the pre-paid service and if the customer doesn't use up the quantity of the service by a predetermine date then I need the balance to autopopulate what was left over.
I hope I'm making sense...
Thank You ahead for any responses.
Bing the beginner
I have the following in a table:
DATE CUST# TRANSTYPE DESCRIP QTY COST
1/1/08 12345 B PRE-PAID SALE 10 $50.00
1/2/08 12345 C SERVICE USE -1 $0.00
1/3/08 12345 C SERVICE USE -1 $0.00
I would like to create a query to have the following results:
same as on top with [DATE] and [CUST#] but add...
TRANSTYPE DESCRIP QTY COST CHARGE BALANCE
B PRE-PAID SALE 10 $50.00 0.00 $50.00
C SERVICE USE -1 $0.00 -$5.00 $45.00
C SERVICE USE -1 $0.00 -$5.00 $45.00
It's easy to create a field for the balance: IIF([TRANSTYPE] = "B", [tbl].[COST],[tbl].[BALANCE]+ [CHARGE])...The problem I'm having is to create an expression/function that will calculate/populate the CHARGE table for me. Each pre-paid sale is at a different cost and basically the [CHARGE] field which I want to be ([COST]/[QTY] for the first row that has [TRANSTYPE] = "B".
Is this even possible with the current functions of access or do I need to create a custom VBA code. The other catch if...it is even possible is that there is an expiration date on the pre-paid service and if the customer doesn't use up the quantity of the service by a predetermine date then I need the balance to autopopulate what was left over.
I hope I'm making sense...
Thank You ahead for any responses.
Bing the beginner