I have a report and I want to introduce a value to a field (that's not part of any table) when I open it for preview. Then, the introduced value has to increment itself with 1, for every record.
Is it possible?
For starters go to Modules - design. Below "Option Compare Database" type
Public MyVariable As Integer
As far as incrementing it in your report, you could always add it to the current record number. Add a text box to your detail section and then in the On Format event for the detail section:
For starters go to Modules - design. Below "Option Compare Database" type
Public MyVariable As Integer
As far as incrementing it in your report, you could always add it to the current record number. Add a text box to your detail section and then in the On Format event for the detail section:
Thank you for your help.
I tried both ways, but it's not working. When I tryed to open the report for preview, an error message raised up telling me that it couldn't find the table or query with the name (let's say) x. Then I made a table and named it x. After that the report has opened, but was showing me another number (1), diferent from the one I introduced in that small window, and no other data at all. After opening it for second time, same result, but incremented number=2, this time.
I think the problem is, that my report is based on a query bilt up from more tables.
You need to add 2 text boxes to the detail of your report
say
txtreccnt This has contol source =1 runningsum yes and visible no
txtmyvar control source =([paramstart]+txtreccnt]-1)
When the report is opened you will be asked for paramstart
I am assuming that you want a numeric starting point other than 1 but am puzzled as to why.
Yes, I want a numeric starting point other than 1 and it's for invoices. I have some pre-printed invoices, and the invoice number of the pre-printed invoice has to be the same as one i'm printing. It's working now (thanks to you), the only problem is, that usually this numbers are begining with 0-s, e.g. 00037851. But if it's inpossible to appear like this, i rather leave them out, and reamains only the pre-printed number.
Correction, just tried something, make the Format property of the textbox, in my example txtmyvar, 00000000 to give an 8 digit number with leading 0s, the leading 0s need not be typed into the parameter box.