Link to home
Start Free TrialLog in
Avatar of c9k9h
c9k9h

asked on

Access with Teradata backend Need to simulate AutoNumber

Hello,

I have recently swapped the back end of a database from the access .mdb to a Teradata table. I'm running into a problem with this seeing as Teradata does not offer an autonumber data type. Is there anyway I can use something as a substitute? My current column for the autonumber is the RequestID I've tried creating a field on the form for this id and doing something like RequestID = RequestID + 1 (and the likes) with no success.
Any ideas would be GREATLY appreciated!

Thanks in advance!
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

You would use something like:

me.txtrequestid = Dmax("RequestId", "tablename")+1

Unless you have a need to see the number then I would put this code in the Form_Beforeupdate event procedure, so that it is only allocated as the record is saved.  Otherwise you will have to save the record as soon as the number is obtained to prevent another user from using the same number.
Avatar of c9k9h
c9k9h

ASKER

No there will be no need to see the number whatsoever... its strictly to have a unique ID.

what sub would i put the me.txtrequestid = Dmax("RequestId", "tablename")+1  in?
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of c9k9h

ASKER

You know peter, you really are a genius :)

works perfectly!
Avatar of c9k9h

ASKER

Excellent answer, worked perfect!!!
I'm afraid that on EE 'Genius' status is as much a function of time as it is of ability.
The really clever ones only stay a short while, amass a stack of points and then move on.

But thanks anyway.