tweetyksc
05-14-2003, 11:51 AM
This is one of those things that I do on the fly and usually have no problems but sometimes I have to redo it til I get it right. I'm sure it's simple, but just one of those things.
When I'm adding a text box on a report and want fields to show up, I usually have no problems, but when I want to combine text with those fields, I have problems. I can't get this one going, and I can't see what I've done. Header is OK, footer not. I have more complicated ones in other reports that work just fine.
----------------------------------------------
Header:
[Month] & " " & [Year]
Display: April 2003 (OK)
Footer:
="District Summary by Month " & [Month] & " " & [Year]
Display: #Error
------------------------------------------------
What am I doing wrong? I hate to even have to ask for something so silly!
jeremie_ingram
05-14-2003, 12:22 PM
Just a thought, but dont the dates need to be enclosed within #'s?
Pat Hartman
05-14-2003, 12:29 PM
1. You should not use function names as names for your objects. Both Month() and Year() are intrinsic VB functions and you will frequently run into problems because of the confusion factor (Access can't always tell whether you mean to refer to your field or a VB function) once you try to use them in anything other than a query.
2. The control name (Other tab) of a calculated control must NOT duplicate the name of any column in the form's recordsource.
tweetyksc
05-14-2003, 12:43 PM
Pat,
1 - noted! That's an important point.
2-In this instance, [year] and [month] are fields from the report's underlying query, (in the query it is calculated from the date field). I haven't named these text boxes (still have default txtxxx, I just inserted them on the report have been trying to get them to display correctly. don't have a calculated control anywhere on the report that is named month or year...
What I noticed is even if I copy and past the header text box (which works fine there) and paste it in the footer, it displays "error"
...I'm thinking I'm missing some kind of important point as it relates to procedures here?
Pat Hartman
05-15-2003, 09:20 PM
Make sure you put the control in the Report footer or a section footer but NOT the page footer.
You may need to change your column names to get past the problem.
tweetyksc
05-16-2003, 06:46 AM
That's the problem...I'm trying to put it in the page footer.
That's what I'm getting at - is that something that can't be done - putting this in a page footer?
I want the name of the report and the month/year to show up on each page. I have changed all the queries to have MTH, YR instead of the fx names.
I have many other reports where this would be helpful so I'm trying to figure out if this is just not able to be done....ex: in a report where data is run by month--I want the report name and the month to show at the bottom of every page.
Pat Hartman
05-16-2003, 11:44 AM
Sometimes reports have trouble with calculated fields.
1. Make certain that the control name is NOT the name of any field in the recordsource. I always change all my control names as soon as I add controls to a form/report. So MNTH would become txtMNTH. That way it is always clear to VBA when I am referring to a control versus a field from the recordsource.
2. Delete the queryname from the report's recordsource, save the form and repaste the query name. This will force the report to refresh its fields collection.
3. If all else fails, move the calculation to the query so that you can use a bound field in the footer. I have not had any trouble using bound fields in the page footer. The only thing you can't use in that footer is aggregate functions. If you want page totals, you need to calculate them yourself.