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!

calculated controls on a report 1

Status
Not open for further replies.

kevin531

Technical User
Sep 25, 2002
33
0
0
US
Hello, i have a report that has "unit #", "date of maintenance", and "mileage". what i want the report to do is forcast the next time vehichles will need serviced. i want to simply add 3000 to the miles control. i've tried doing this everyway i can think of but nothing works. i will then need the same thing with the date. when i do this i usually get a #name? error. could someone please show me how to do this. any help would be great. thanks.
-Kevin531
 
Kevin can you post what you tried to use. It should be simple to create a calculated control on a report. In the Control Source for an unbound textbox put
=[Mileage]+ 3000

and for the date it should be
=DateAdd("d",90,[Date of Maintenance])

If you've tried something like this, give us some more info about the report and the textboxes.

Paul
 
Hi, you can do that several ways. First, ensure your control is named differently from your control source -

control = [date], control name = txtDate for example.
control = [mileage], control name = txtMileage

You can add separate text boxes in the detail section of your report: =txtMileage + 3000 and =txtDate + 30.

You can also use one control: =[Date]+ 30

Or from a Query using an alias: ProjDate: [Date]+30

Hope that helps

 
hey guys, that worked. it was a circlular referance. thanks.

kevin531
 
I'm happy it worked but I don't quite understand the circular reference. If you use the wizard to create a Report, all the bound textbox names are the same as the Control Source so if the control source is [Mileage] the textbox will be named Mileage. Your control name and your textbox name can be the same.

Paul
 
i did what pdldavis suggested and checked to make sure the text box was named differently from the control source. thats what made it work. i changed it back to the original name to see if it mattered and it does. i get "#error" when the names are the same.
thanks.
 
Well I won't argue with you because I can't see your data but in A2000, you can do calculations with a Report control that has the same name as the Control Source (I did double check that before I posted so I didn't put my foot in my mouth). Anyway, glad you got it working.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top