RE: MAX() operator with auto number field

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: kasab (kasab_at_discussions.microsoft.com)
Date: 03/27/05


Date: Sat, 26 Mar 2005 16:47:02 -0800

Fixed it. Please ignore this post. Thanks!

"kasab" wrote:

> The following query returns the wrong answer:
> SELECT Max(job.job_id) AS MaxOfjob_id FROM job;
> In this case, job_id is an auto number field of the job table, and its
> primary key. I built the query interactively using the Query grid.
>
> The problem is that there are 10 records in the job table (no deletions), so
> the maximum job_id should be 10. It is consistently 9.
>
> Why?
>
> How can I get the correct answer (interactively, or using VBA)?
>
> Thanks for your help



Relevant Pages

  • Re: auto number vs byte
    ... > beginning I designed the primary key to be number ... > instead of auto number in order to save on resourses and ... > lot more difficult in programming compared to auto number. ... > a more complex routine to handle addition of new items ...
    (microsoft.public.access.formscoding)
  • RE: crosstab or looping statement help
    ... number can appear in multiple counties). ... The primary key is an auto ... The other table (tReview) has another auto number primary key with ...
    (microsoft.public.access.reports)
  • Re: Form Save
    ... You calculate the new value for this Primary Key in the Before Update event ... they get the same calculation. ... Auto Number ... Increment number ...
    (microsoft.public.access.modulesdaovba)
  • Re: auto number vs byte
    ... Now, in terms PK storage, this translates to 256 bytes per table ... > beginning I designed the primary key to be number ... > lot more difficult in programming compared to auto number. ... > a more complex routine to handle addition of new items ...
    (microsoft.public.access.formscoding)
  • Re: auto number primary key
    ... Can I import data in to a table with auto number primary key? ... "Jeff Boyce" wrote: ... primary key of the "one" side table, and you'd need to add a LongInt field ...
    (microsoft.public.access.tablesdbdesign)