G
GM
Hi,
I would appreciate some help with the following, hopefully I am going about
it the right way. I'm a bit new at this sort of access stuff.
I am calling a query from a form that retrieves a value from a list box
I then need this value to form part of the select statement of the
subsequent query.
Simplified example:
I have a table that has the following detail:
Table: MonthlyBudget
AccountNo Month1 Month2 Month3 Month4......
ac1 100.00 200.00 129.00
ac2 101.00 202.00 930.00
ac3 104.00 210.00 292.00
The aim of my query is to return a specific months figures according to the
parameter
eg where paramatervalue=2 (for Month2)
AccountNo Month
ac1 200.00
ac2 202.00
ac3 210.00
I am attempting to do this as follows:
SELECT "2" as Prd, MonthlyBudget.[Ac Ref],
dlookup(("Month"&""&[Prd]),"MonthlyBudget") AS Month
FROM MonthlyBudget;
(I've replaced my list box=Prd with just "2" to simplify things)
The result of the above is only the first value for Month 2 for all
accounts.
ac1 200
ac2 200
ac3 200
I think I need some criteria in my dlookup function but can't figure out
what to put.
(I am not certain dlookup is the best thing to use)
Any help would be very welcome
Cheers
Greg
I would appreciate some help with the following, hopefully I am going about
it the right way. I'm a bit new at this sort of access stuff.
I am calling a query from a form that retrieves a value from a list box
I then need this value to form part of the select statement of the
subsequent query.
Simplified example:
I have a table that has the following detail:
Table: MonthlyBudget
AccountNo Month1 Month2 Month3 Month4......
ac1 100.00 200.00 129.00
ac2 101.00 202.00 930.00
ac3 104.00 210.00 292.00
The aim of my query is to return a specific months figures according to the
parameter
eg where paramatervalue=2 (for Month2)
AccountNo Month
ac1 200.00
ac2 202.00
ac3 210.00
I am attempting to do this as follows:
SELECT "2" as Prd, MonthlyBudget.[Ac Ref],
dlookup(("Month"&""&[Prd]),"MonthlyBudget") AS Month
FROM MonthlyBudget;
(I've replaced my list box=Prd with just "2" to simplify things)
The result of the above is only the first value for Month 2 for all
accounts.
ac1 200
ac2 200
ac3 200
I think I need some criteria in my dlookup function but can't figure out
what to put.
(I am not certain dlookup is the best thing to use)
Any help would be very welcome
Cheers
Greg