MAX() operator with auto number field

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


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

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: Cant update table data from form
    ... > tables (the form is built on tables, not queries). ... to more than one newsgroup, ... If the record source of the form is a table (not a multi-table query) ...
    (microsoft.public.access.forms)
  • Re: Multiple Statements in a query
    ... What I'm doing is an insert of a row, where the primary key is an auto ... tried sending another query after the first (once I knew that it the ... increment field all you have to do is query the maximum value in that ...
    (comp.lang.php)
  • Re: Many-to-many relationships
    ... 1."But when you built the query for the combo boxes, ... All the fields in the subform are technically updatable. ... it is best to disallow updates. ... I built the forms that way to show you that the relation table can ...
    (microsoft.public.access.gettingstarted)
  • Re: Entering data in one form while updates 2 or more tables
    ... query, which was built from two queries and one table. ... you can certainly use VBA code in the form's AfterUpdate event to open a ...
    (microsoft.public.access.forms)
  • Re: How to use a parameter query with multiple values?
    ... You have to built the string made of the concatenation of the selected ... I have gotten it to work where, when the query is run, the parameter asks ... This can work as long as there are no commas within the subject ...
    (microsoft.public.access.queries)