PC Review


Reply
Thread Tools Rate Thread

DMax and AutoNumber

 
 
=?Utf-8?B?ZGFybmV0dA==?=
Guest
Posts: n/a
 
      26th Oct 2007
I have a database that uses a project number as a key in two tables. The
project number is similar to 16217-001 where 16 is the project code, 217 is
the location and 001 refers to this being the first project for the location.
I am trying to create a code or expression that will give me the DMax of the
last three digits for each project and location.

Basically, if I have a second project for location 217 for a 16 project, I
want access to generate this for me.

Any help will be appreciated.
 
Reply With Quote
 
 
 
 
Larry Daugherty
Guest
Posts: n/a
 
      26th Oct 2007
Keep that last 3 digit component as a separate field. You can
DMAX(yourtableandfield)+1 and use that as the new value to store in
that field and to concatenate and display with the other components of
your "intelligent key".

HTH
--
-Larry-
--

"darnett" <(E-Mail Removed)> wrote in message
news:41A568C7-EE11-4851-BAA3-(E-Mail Removed)...
> I have a database that uses a project number as a key in two tables.

The
> project number is similar to 16217-001 where 16 is the project code,

217 is
> the location and 001 refers to this being the first project for the

location.
> I am trying to create a code or expression that will give me the

DMax of the
> last three digits for each project and location.
>
> Basically, if I have a second project for location 217 for a 16

project, I
> want access to generate this for me.
>
> Any help will be appreciated.



 
Reply With Quote
 
Larry Daugherty
Guest
Posts: n/a
 
      26th Oct 2007
Oh, not to make too big a deal of it but the DMax()+1 paradigm creates
a *sequence* which is what most people want when they miss-apply the
Autonumber datatype.

An Autonumber datatype is a horse of a different color. It is a very
special purpose datatype that is intended only to generate unique long
integer values to serve as surrogate Primary Keys. They are *not*
guaranteed to be sequential and, in time and with lots of use, can
almost be guaranteed to be non-sequential.

HTH
--
-Larry-
--

"Larry Daugherty" <(E-Mail Removed)> wrote in
message news:%(E-Mail Removed)...
> Keep that last 3 digit component as a separate field. You can
> DMAX(yourtableandfield)+1 and use that as the new value to store in
> that field and to concatenate and display with the other components

of
> your "intelligent key".
>
> HTH
> --
> -Larry-
> --
>
> "darnett" <(E-Mail Removed)> wrote in message
> news:41A568C7-EE11-4851-BAA3-(E-Mail Removed)...
> > I have a database that uses a project number as a key in two

tables.
> The
> > project number is similar to 16217-001 where 16 is the project

code,
> 217 is
> > the location and 001 refers to this being the first project for

the
> location.
> > I am trying to create a code or expression that will give me the

> DMax of the
> > last three digits for each project and location.
> >
> > Basically, if I have a second project for location 217 for a 16

> project, I
> > want access to generate this for me.
> >
> > Any help will be appreciated.

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autonumber (Using Dmax) on Continuous Forms Jeff Monroe Microsoft Access Forms 1 29th Aug 2009 06:48 AM
Alternatives to DMax when generating custom autonumber Mark Microsoft Access Forms 1 24th Apr 2006 12:59 PM
Simulated Autonumber using Dmax question Phil Microsoft Access Queries 1 17th Apr 2006 09:31 PM
DMax and Autonumber Tom Hart Microsoft Access Macros 1 4th Mar 2004 08:58 PM
autonumber/dmax?? Michelle Microsoft Access Queries 1 29th Jan 2004 05:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:46 PM.