?
Solved

Access with Teradata backend Need to simulate AutoNumber

Posted on 2008-02-06
6
Medium Priority
?
571 Views
Last Modified: 2011-10-03
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!
0
Comment
Question by:c9k9h
  • 3
  • 3
6 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 20833602
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.
0
 

Author Comment

by:c9k9h
ID: 20833657
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?
0
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 total points
ID: 20833775
'the Form_Beforeupdate event procedure'

Display the form properties and in the event properties click into the BeforeUpdate event. Choose EventProcedure from the list. Clicjc the Build button (...) to the right and you are where the code needs to go.

Obviously you must use your own object/field names.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:c9k9h
ID: 20834077
You know peter, you really are a genius :)

works perfectly!
0
 

Author Closing Comment

by:c9k9h
ID: 31428537
Excellent answer, worked perfect!!!
0
 
LVL 77

Expert Comment

by:peter57r
ID: 20834300
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.


0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
This article will show a step by step guide on how to mask column values in Oracle 12c using DBMS_REDACT full redaction option. This option is available on licensed Oracle Enterprise edition as part of Oracle's Advanced Security.
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question