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

Query Question

Status
Not open for further replies.

kathyc20

Programmer
Mar 7, 2001
96
CA
I need to comfigure the following in the Report Footer section of my report for each month of the year:

In the control source of a text box, I need to write code that does the following math:
(31 - Sum(Holidays_Month)) * txtBasePerDay
where month = 'January'

31
- Is the number of days in that particular month.

Holidays_Month
- Holidays_Month needs to be a query where I can get
the sum of the field Holidays_Month
where Holiday_Month = 'January'

txtBasePerDay
- Is a textbox on the form (just above this one), that has a value I need to reference.


I hope someone can assist me. I am really stumped.

 
Replace txtBasePerDay with forms!nameofForm!txtBasePerDay
that's unless the textbox is on a sub form

Ian M (uk)


Program Error
Programmers do it one finger at a time!
 
Thanks Ian.

I tried the following in the control source box and am still getting an error. I am signifying months as 01, 02, etc.


=(31-Sum([Holidays_Month]))*[txtBasePerDay] And [Month]='01'
 
what's the error you're getting?
Is Holiday_month in a number value in a record?
Is it you only want to show the result of the calculation if the month is january, feb etc?
or do you want the select records only from that month?


Program Error
Programmers do it one finger at a time!
 
Try

=IIf([month]=1,((31-Sum([Holidays_Month]))*[txtBasePerDay]),"somethingelse")

If you want to make txbaseperday get its value from the form You need to replace [txtBasePerDay] with [forms]![TheNameOfTheForm]![txtbaseperday]

Program Error
Programmers do it one finger at a time!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top