deagon
Posts: 31
|
| Posted: 10/04/2007, 11:08 AM |
|
I'm sure this has been done it can't be that complicated. I have SQL backend with CodeCharge 3.0 . I'm trying to create a Auto number in a JobNum field that will pick up the last number used lets say 4000 and when new data is entered it will select 4001. I've tried if then statements and compare but it is really sloppy. Is there a quick way to auto number a field and then add on the end of the number 4000.i or 4000.r or 4000.2? If I select a new Jobnum for a product and then say I want the same Jobnum but with a add on varible to make this consistant to each Customer? I hope i'm explaining this situation well enough to be understood. I've tried auto increment with prinmary key and that works but my code is not using the ID field for this fuction. I've changed my Jobnum field to primary key and that works but it would create more problems then fix with the code that is already written.
I sure could use your help in a direction to go in.
Thanks,
|
 |
 |
Bubba
Posts: 33
|
| Posted: 10/18/2007, 5:52 PM |
|
I have done a similar thing using an Access database.
I created a table called JobnumStart, with one field called Jobnum.
This holds the start number eg: 4000
Then on a Before Show I use this code:
JobnumStart = CCDLookUp("numStart ","[ Jobnum]" DBConnection1)
NewJobnum = JobnumStart + 1
Jobnum = NewJobnum
Now run some code to update the JobnumStart table (numStart ) with the new Jobnum value.
Hope this makes sense.
|
 |
 |
deagon
Posts: 31
|
| Posted: 10/19/2007, 6:30 AM |
|
Thanks Bubba for your response. It worked like a charm.
|
 |
 |
Oper
Posts: 1195
|
| Posted: 10/21/2007, 4:02 PM |
|
be aware of this method in a heavy multi user enviroment.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
|