I am using Word 2002 for my commercial Purchase Orders. I would like to add a unique order number to a form when it is saved or opened, is there a solution to it???
I don't think I explained v.well!! My system works like this: C00xx. Obviously each new p/o increases the value of xx by one. So the idea would be to generate a new number on opening or saving the document. Sorry for being unclear!!
No probs. If you do use a database you could still do it the same way i.e the ID field starts at 1 and increments by 1 each time. Each time a new order is placed you write it out to the word file as:
Code:
OrderNumber = "C0" & rs("ID")
where id is the value of the record in the database.
If you don't use a database then that is still OK but you will have to decide where you store this number (it has to be somewhere where it can be read and updated). Possibilities are a registry entry (you read it, assign it to the order and then update it to add 1 to its value) or maybe even a text file (same scenario as above).
No matter which way you do it, the procedure of doing it is basically the same, it's just up to you how you prefer to do it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.