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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with Mad Expressions

Status
Not open for further replies.

jerry13

Programmer
Jun 19, 2001
4
CA
The following expression works on a report.
Me.Text18.ControlSource = "=Int((Sum([qryAllFieldsForReports]![TotalCount]-[qryAllFieldsForReports]![RandomCount])/(Sum([qryAllFieldsForReports]![TotalCount]))*100))"

What I want to know is how to change the query on which the expression is based. I tried to subsitute the following for these parts "[qryAllFieldsForReports]![TotalCount]" and "[qryAllFieldsForReports]![RandomCount]" with no luck.

sqltest = "SELECT qryAllFieldsForReports.* FROM qryAllFieldsForReports WHERE (((tblLogDetail.Date) Between #" & SQLdate & "# And #" & SQLdate2 & "#))"


In the end I want to be able to do this:

Me.Text18.ControlSource = "=Int((Sum([" & sqltest & "]!TotalCount -([" & sqltest & "]![RandomCount])/(Sum(([" & sqltest & "]!TotalCount))*100))"


Any suggestions on how I can make this work?

 
Jerry,

Sounds to me like you need to write a custom function to be able to do this. The tricky part is that you want to be able to pass in different queries. The only way I can think of being able to do this easily is to use the query as part of the function parameters.

HTH

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top