Generate a number

JustMaybe

Registered User.
Local time
Today, 23:04
Joined
Oct 18, 2002
Messages
134
So Stuck..PLEASE help!!!!!!!

hi i've posted this problem before...but haven't had a response i can use yet!!

The problem is sequence numbering of a report, every time a report is previewed i need a number to be generated.

i know this number needs ot be generated on the 'on click' command, but unfortunately i have no idea of the code i need.

Rich suggested using dmax+1 but i'm afraid this doesn't mean anything to me...(i've tried the help functions etc.)

Can anyone please help??

This number needs to be unique and sequential for every report of this type generated!!!!

Thank you so much in advance if anyone can help!!

Sarah
 
Hi Sarah

Do you need a number printed out on the report that is one greater than the previous number on the previous report?

You refer to print preview which is the step before the actual printing.

Col
:cool:
 
Hi col,

that is exactly what i need...each number increasing by one

When i say opens on preview...this has to be the case....the user has decided they'd rather preview the report then print it...rather than print it immediatly!!! But i am presuming that all reports previewed will be printed!!

Would it work better if the user directly printed the report????

Am sooo stuck!! I also need that number to be saved in a table and displayed on the relevant form for later reference!

Sarah:)
 
Hi Sarah

So the report is of the details on a form. Then you presumably have a button that says something like "Print Detail"? So what is the report actually printing?

If its something like customer details or something then you'll need a field in the table (of the form) that can hold the number and display it when you view the form. This number could then be updated when you click the "print detail" button. The field can then be put on the report so it shows there. A bit like "This report has been printed XXX times"

Bet thats the wrong track

Col
:cool:
 
Hi Col,

the report is called an 'invoice' it is produced in connection to three other reports ...they all display similar data, and take details from the same form. Yet they have slightly different calculations etc.

The invoice needs a separate number for analysis reasons!

You are completely on the right track!!

I do have customer details etc!!
I have also set up a field in my underlying table and query, this field is displayed very sadly as blank at present....!!

Your idea is exactly what i need!! (i hadn't even thought about it like that!!!!)
Thing is ..with my lack of coding skills thats about as far as i can get...i'm used to trying things again and again untill they work!! but this is literally an issue i've avoided for ages!

Do you have any ideas as to how your idea could be implemented?

Thank you so much for your help so far!!

Sarah :confused:
 
Ok Sarah - we're getting there!

Put a textbox on the form and link the control source to the number field you have in your table.

In the field in the table, enter a number. When you look at the form now, you should see the number you've just entered.

In the properties of the "print invoice" button, go to the "OnClick" and look at the code. Put in this bit of code before the command to preview the report:

Me.YourNumberFieldName = Me.YourNumberFieldName + 1

The field with the number in it should increment by 1 and hopefully be saved in the table.

You can put the field (with the number) on your report now and that may work. (I haven't tested it)

Col


:cool:
 
So close Col...so close!!!!

I used this ...at first all appeared to work as hoped!!!!

i typed in a number and when i 'printed invoice' the number incremented!!!! (was so chuffed!!!)

then.....i did the same for the next record...and all i got was 1...and the next....

It must be that unless i type an actual number into each records relevant field that access sees the field as blank (=0)...and therefore an increment of 1 will always equal to one!!!

any ideas how to get out of this one????

thank you so much for being so kind as to get me this far!! it has been soooo appreciated, it really has!

Sarah :D
 
Hi Sarah

The reason I suggested "hard" typing into the table is to ensure that there is a number there for the invoice.

You will need to start off each invoice number with whatever you choose then whatever invoice you have on the screen it will show the number you entered.

It will as you discovered start at 0 then 1 and 2 etc. I suggest you put in 10 ffor the first 100 for the second 300 for the third etc once you have established that its going ok then you can put in the "proper" numbers you want them all to start at.

I'm off home in 15 mins

Col
:cool:

ps - I'll send you my address for the chocolates for me and Ally (who helped with your other prob)!!!!!!!!!!!!!
In case you hadn't guessed - I work with Ally.
 
thank you so so so so much!!!!

You and Ally have both been great ..thank you so much

Chocalates all the way!!!

You really have helped me (and my job) so much..your both brilliant!!

:D :D :D
 

Users who are viewing this thread

Back
Top Bottom