Introducing a value into the report via a dialog box

atisz

Registered User.
Local time
Today, 11:39
Joined
Apr 5, 2005
Messages
96
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?

Thanx!
 
How about using a public variable?
 
:)

RichO said:
How about using a public variable?

I'm sure this is what I need, but I'm not that good, to be able to make it alone. Can you tell me exactly how to do it?
Thanx.
 
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:

Me.txtMyTextBox = Me.CurrentRecord + MyVariable

or your could do

MyVariable = MyVariable + 1
Me.txtMyTextBox = MyVariable
 
Problem

RichO said:
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:

Me.txtMyTextBox = Me.CurrentRecord + MyVariable

or your could do

MyVariable = MyVariable + 1
Me.txtMyTextBox = MyVariable

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.

Attila
 
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.

Brian
 
Thank you!

Brianwarnock said:
I am assuming that you want a numeric starting point other than 1 but am puzzled as to why.

Brian

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.

Thank you for your help.

Attila
 
Happy to help, but sorry I don't know how to include the leading Zeroes.

Brian
 
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.

Brian
 
Yessssssssssssss!

Thank you Brian, it's working.

Attila
 

Users who are viewing this thread

Back
Top Bottom