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

Incrementing a user entered value from a form to a report 1

Status
Not open for further replies.

Gooter

Technical User
Apr 5, 2002
20
US
First of all, I am a complete novice with Acess. Here is what I want to try to do.

I want to create a report that takes a user-entered number from a form and then auto-increments that number by one for each record generated on the report.

For example...

1. The user enters "25" into a box on the form.
2. Let's say the report pulls 5 records. I want the first record to start with 25, the second 26, third 27, ... , and the fifth 29.

I don't need to store these numbers in a table. I only need it for output purposes. I am assuming the report will have a text box dedicated to the numbers I want to output. I know how to map the text box to the number the user enters on the form

ControlSource in text box: =[Forms]![NAMEofFORM]![FIELDonFORM]

My problem is I can not figure out how to increment that number by one for each record generated on the report.

If you need further info, please let me know. I hope I explained everything clearly.

Thank you in advance for your help,
MG
 
to increment a number for each line of a report try this:
1) in the form property page set the running sum to "Over All"
2) add a textbox to the data line in the detail section and set the control source as =1
- data line means the data listing which is the body of your report - say "name"

To add the user entered number:
- Add a textbox in the header which will hold the user entered number by entering in the Control source = Forms!frmUserEntry!txtUserEntry
- Add a further textbox which will be the sum of the line number and the user entered number, say....
= Me.txtUserNum + Me.LineNum
 
That worked! Thank you Trend.

I set the "Visible=No" on the two textboxes (txtUserNum and the increment textbox) so they would not appear in the report. I also had to change the formula in the sum textbox to "(txtUserNum + lineNum)-1" because I want the first record in the report to display the number the user entered on the form, then start to increment it.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top