Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dsum Function In A Report

Status
Not open for further replies.

FontanaS

Programmer
May 1, 2001
357
0
0
US
I have the following code:
=DSum("[ObligationAmount]","Tbl_Current_Year_Information","[FiscalYear]= '" & [Curr_Fy] & "'")

The problem is that [Curr_Fy] shouldnot have brackets around it becasue it is a variable that I created to hold the current fiscal year.

Whenever I try to take the brackets off, it puts them on again. Can you have user defined variables in the dsum function?
 
Been there, done it... with no success.
You should create a function that will return the value of this variable:
public functon get_Curr_Fy()
get_Curr_Fy = Curr_Fy
end function

and then use it in your Dsum sentense like this:
=DSum("[ObligationAmount]","Tbl_Current_Year_Information","[FiscalYear]= '" & get_Curr_Fy() & "'")

That solved the problem for me

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top