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 / Database Design / February 2004

Tip: Looking for answers? Try searching our database.

AutoNumber Configuration

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
William K - 16 Feb 2004 20:07 GMT
Greetings,

I have a table with the following fields:
OrderNumber
OrderLocation
OrderID
OrderDate

I want the OrderNumber field to be an autogenerated
primary key based on the OrderLocation and OrderID fields.

So if the Order Location were in Michigan the
OrderLocation Field would contain MI.  The OrderID field
would be an Auto Increment number of say "1".  Therefore
the OrderNumber should be MI1.

I tried to set this up by making the field OrderLocation a
text field with a defualt value of MI.  I made the OrderID
field an Autoincrement number field.  Then I made the
OrderNumber field a text field with the following default
value =[OrderLocation]&[OrderID].  However, when I try to
save the table, I am told that the reference fields are
not valid.  

What am I doing wrong?  Thanks in advance for your help.

William K.
Jeff Boyce - 16 Feb 2004 22:28 GMT
William

You are trying to:  1) save "calculated" data -- there's no reason to do so
when you can use a query to reconstruct the concatenated value;  2) create
an "intelligent" key (this is a derogatory term);  3) put more than one fact
in one field, a "no-no" in relational database design;  4) create a default
value of the concatenated values of other fields BEFORE there's a value in
those fields.

Use a query to combine the Location info and the autonumber ID -- use the
query for your forms, reports, etc.

Signature

Good luck

Jeff Boyce
<Access MVP

 
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.