G
Glint
Hi All,
I am using Access 2002. I want to display cash collections from various
revenue items on a form (CashBook) based on the Revenue table (RevenueID and
Revenue as fields). The bullwork of the form is a query vBalances (a union
query that extracts dates, item and amount from 2 other queries that combine
donations details with donations on one hand, and expenses details and
expenses on the other hand). On my form is an unbound textbox (TMonth) with
format: mmmm yyyy, and it does display any valid date in month and year.
I want Balance1 textbox to display total income for the month displayed in
TMonth textbox; so I put Balance1 control source as: =IIf([TMonth] Is
Null,Null,nz(DSum("[ItemAmount]","vBalances","[DonationItem]=Forms!CashBook!RevenueID And [TDate] = #Forms!CashBook!TMonth#"),0)).
I get #Error message with this code.
When I remove the pound sign #, I get zero when I know for a fact that there
should be more that 0.
I changed the code to: =IIf([TMonth] Is
Null,Null,nz(DSum("[ItemAmount]","vBalances","[DonationItem]=Forms!CashBook!RevenueID And [TDate] IN #Forms!CashBook!TMonth#"),0)).
The error message is the same, with or without the pound sign.
When I use another textbox in place of TMonth that has real date values (say
October 1, 2005), the form works fine.
Can you suggest an easy alternative to accomplish this task?
I am using Access 2002. I want to display cash collections from various
revenue items on a form (CashBook) based on the Revenue table (RevenueID and
Revenue as fields). The bullwork of the form is a query vBalances (a union
query that extracts dates, item and amount from 2 other queries that combine
donations details with donations on one hand, and expenses details and
expenses on the other hand). On my form is an unbound textbox (TMonth) with
format: mmmm yyyy, and it does display any valid date in month and year.
I want Balance1 textbox to display total income for the month displayed in
TMonth textbox; so I put Balance1 control source as: =IIf([TMonth] Is
Null,Null,nz(DSum("[ItemAmount]","vBalances","[DonationItem]=Forms!CashBook!RevenueID And [TDate] = #Forms!CashBook!TMonth#"),0)).
I get #Error message with this code.
When I remove the pound sign #, I get zero when I know for a fact that there
should be more that 0.
I changed the code to: =IIf([TMonth] Is
Null,Null,nz(DSum("[ItemAmount]","vBalances","[DonationItem]=Forms!CashBook!RevenueID And [TDate] IN #Forms!CashBook!TMonth#"),0)).
The error message is the same, with or without the pound sign.
When I use another textbox in place of TMonth that has real date values (say
October 1, 2005), the form works fine.
Can you suggest an easy alternative to accomplish this task?