Generate a unique reference number

htadis

Registered User.
Local time
Tomorrow, 03:19
Joined
Dec 17, 2014
Messages
61
good day !

Need to generate a unique reference number each record wise while data entering by a form. How to do this by using a command button ? After entering all fields related to the record, when click on the command button, unique reference number for that record need to be generated and save with all other data of the records. in a later event, need to recall the record by using this reference number and also need to make relation ship with some other table by using the reference number.

How can i programme this ?
 
Additionally there are samples in the Sample Database Section.
 
thanks !

but can we generate this when we click on a command button. if with some letters that is much better. eg XYZ/GAA021/RO001
 
Sure, but why? What's so magical about this button you have in mind? Why can't the number be created as soon as the record is created?

Same question for the letters--sure, but why? If this is to make records unique, what's so special about letters? Do you have rules for how you want these letter codes generated?
 
Depending on what this string XYZ/GAA021/RO001 represents, you may need to break this into at least 3 segments. Then join them at the time of viewing or printing. Using the after update trigger could be more handy, again depending on your needs.
 
Different ways of doing this as has been said and advised. Also as asked, do you have set rules for the syntax?
Example:
PHP:
ControlSource=[InvNo] & "-" & [ReferenceID] & "000"

Personally I use a Module with a table for my unique generated numbers.

HTH
 

Users who are viewing this thread

Back
Top Bottom