Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Multiuser / Networking / August 2005

Tip: Looking for answers? Try searching our database.

Obtain new ID number from another table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mail Merge Help - 30 Aug 2005 00:34 GMT
Hi

I have a Customer table with the below fields.
CustID  [Autonumber][Primary key]
Name
Address

Sometime I want to archived the non active customer to another
Archived_Customer table where data can't be edit.

The problem is that if I archived the customer with the last CustID to the
Archived_Customer Table, the Customer table will create the new CustID that
could be duplicate to one of the non active customer in the Archived_Customer
table. This will cause Key violations when append to the Archived_Customer
later on.

Is there a way to fix this problem?
I am thinking of obtain the CustID from another table, eg CustID register.
so when ever a new customer ID create it will get the next available number
in the CustID Register table? But I don't know how to do this. Could you
please help.

Thank you very much
Hong
Steve Schapel - 30 Aug 2005 18:49 GMT
Hong,

If CustID is an Autonumber field, then you will not have the problem you
anticipate.  If you archive the customer with the highest CustID, the
CustID assigned to the next new customer added will still be the next
higher number again.

Signature

Steve Schapel, Microsoft Access MVP

> Hi
>
[quoted text clipped - 20 lines]
> Thank you very much
> Hong
Mail Merge Help - 30 Aug 2005 23:37 GMT
Steve.

Say if 10 is the highest number in the Customer table, I archived 10. When I
say I archived mean that I transfer 10 to another table and delete 10 from
the Customer table. therefore number 9 will be the highest. so when a new
record created, 10 will be the next number.

Am I right?

Thanks

> Hong,
>
[quoted text clipped - 27 lines]
> > Thank you very much
> > Hong
Steve Schapel - 30 Aug 2005 23:51 GMT
Hong,

No, you are not right.  If CustID is an Autonumber field, then a new
customer added would have CustID 11.  An Autonumber field does not
increment based on the highest existing number in the table, it
increments according to the highest number that has *ever existed* in
the table.

Signature

Steve Schapel, Microsoft Access MVP

> Steve.
>
[quoted text clipped - 6 lines]
>
> Thanks
Mail Merge Help - 31 Aug 2005 00:01 GMT
Steve

Thanks, I just tried it out and yes, the next number is 11 not 10.

Thank you very much for your help.

Hong

> Hong,
>
[quoted text clipped - 14 lines]
> >
> > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.