I have a database with records that should have a consecutive number
ID (Check Register). Also has other records (deposits and adjusting
entries) that don't fit in the number range so autonumbering isn't the
answer. I want to check to see if any check numbers are missing from
the register, but can't figure out how to accomplish it. Thanks for
any help.

1. Build a table of numbers that starts with the first check# in the checking
account and goes to what you anticipate will be the highest check number ever
used in the account. You can easily generate the numbers in Excel and then
import into an Access table.

2. Build a query named QryAllPossibleCheckNum based on the numbers table and in
the numbers field enter the criteria:
Between XXXStartCheckNum And XXX EndCheckNum

3. Build a query named QryCheckNumOfPostedCheck and in the CheckNum field enter
the criteria:
Between XXXStartCheckNum And XXX EndCheckNum

Note: You will have to determine how to write the actual criteria based on
where you get the first and last check#s.

4. At the database window, at the query tab, click on New. One of the options
will be Find Unmatched Query. Use this wizard to find the numbers in
QryAllPossibleCheckNum that are not in (unmatched) QryCheckNumOfPostedCheck.
This new query will return all missing check numbers.

I have a database with records that should have a consecutive number ID (Check Register). Also has other records (deposits and adjusting entries) that don't fit in the number range so autonumbering isn't the answer. I want to check to see if any check numbers are missing from the register, but can't figure out how to accomplish it. Thanks for any help.

Thanks PCDatasheet. Have done something similar in the past, but
thought there might be a function or code that I had missed.
Appreciate the response.
"PC Datasheet" <sp**@nospam.spam> wrote in message news:<BP*****************@newsread3.news.atl.earth link.net>...

1. Build a table of numbers that starts with the first check# in the checking account and goes to what you anticipate will be the highest check number ever used in the account. You can easily generate the numbers in Excel and then import into an Access table.

2. Build a query named QryAllPossibleCheckNum based on the numbers table and in the numbers field enter the criteria: Between XXXStartCheckNum And XXX EndCheckNum

3. Build a query named QryCheckNumOfPostedCheck and in the CheckNum field enter the criteria: Between XXXStartCheckNum And XXX EndCheckNum

Note: You will have to determine how to write the actual criteria based on where you get the first and last check#s.

4. At the database window, at the query tab, click on New. One of the options will be Find Unmatched Query. Use this wizard to find the numbers in QryAllPossibleCheckNum that are not in (unmatched) QryCheckNumOfPostedCheck. This new query will return all missing check numbers.

I have a database with records that should have a consecutive number ID (Check Register). Also has other records (deposits and adjusting entries) that don't fit in the number range so autonumbering isn't the answer. I want to check to see if any check numbers are missing from the register, but can't figure out how to accomplish it. Thanks for any help.

Thanks PCDatasheet. Have done something similar in the past, but thought there might be a function or code that I had missed. Appreciate the response.
"PC Datasheet" <sp**@nospam.spam> wrote in message

news:<BP*****************@newsread3.news.atl.earth link.net>...

1. Build a table of numbers that starts with the first check# in the
checking account and goes to what you anticipate will be the highest check number
ever used in the account. You can easily generate the numbers in Excel and then import into an Access table.

2. Build a query named QryAllPossibleCheckNum based on the numbers table
and in the numbers field enter the criteria: Between XXXStartCheckNum And XXX EndCheckNum

3. Build a query named QryCheckNumOfPostedCheck and in the CheckNum field
enter the criteria: Between XXXStartCheckNum And XXX EndCheckNum

Note: You will have to determine how to write the actual criteria based on where you get the first and last check#s.

4. At the database window, at the query tab, click on New. One of the
options will be Find Unmatched Query. Use this wizard to find the numbers in QryAllPossibleCheckNum that are not in (unmatched) QryCheckNumOfPostedCheck. This new query will return all missing check numbers.

I have a database with records that should have a consecutive number ID (Check Register). Also has other records (deposits and adjusting entries) that don't fit in the number range so autonumbering isn't the answer. I want to check to see if any check numbers are missing from the register, but can't figure out how to accomplish it. Thanks for any help.

It's a bit late for the original poster perhaps, but the following can also
be used:

Table: Ones
Field: Ordinal
Values: 0 - 9 (10 rows)

Table: CheckRegister
Field: CheckID
Values: 1117658 to 1117698 with a few deletions.

Query:
SELECT N.L AS Missing
FROM CheckRegister RIGHT JOIN [SELECT
111*10^4+[O3].[Ordinal]*10^3+[O2].[Ordinal]*10^2+[O1].[Ordinal]*10+[O0].[Ord
inal] AS L
FROM Ones AS O0, Ones AS O1, Ones AS O2, Ones AS O3
WHERE
(((111*10^4+[O3].[Ordinal]*10^3+[O2].[Ordinal]*10^2+[O1].[Ordinal]*10+[O0].[
Ordinal]) Between 1117658 And 1117698))]. AS N ON CheckRegister.CheckID =
N.L
WHERE (((CheckRegister.CheckID) Is Null));

The "Ones" have only a Cartesian join. This creates for seven places a
rather large initial resultset, requiring many seconds. So the generated
number has been shortened to 4 digits, with the common "111" set as a
constant value. The above takes less than a second to run (1.2GHz).

Thanks PCDatasheet. Have done something similar in the past, but thought there might be a function or code that I had missed. Appreciate the response.
"PC Datasheet" <sp**@nospam.spam> wrote in message news:<BP*****************@newsread3.news.atl.earth link.net>...

1. Build a table of numbers that starts with the first check# in the checking account and goes to what you anticipate will be the highest check
number ever

used in the account. You can easily generate the numbers in Excel and

then import into an Access table.

2. Build a query named QryAllPossibleCheckNum based on the numbers
table

and in the numbers field enter the criteria: Between XXXStartCheckNum And XXX EndCheckNum

3. Build a query named QryCheckNumOfPostedCheck and in the CheckNum

field

enter the criteria: Between XXXStartCheckNum And XXX EndCheckNum

Note: You will have to determine how to write the actual criteria

based on where you get the first and last check#s.

4. At the database window, at the query tab, click on New. One of the

options will be Find Unmatched Query. Use this wizard to find the numbers in QryAllPossibleCheckNum that are not in (unmatched)
QryCheckNumOfPostedCheck. This new query will return all missing check numbers.

"GSpiggle" <ga***@yahoo.com> wrote in message news:de**************************@posting.google.c om... > I have a database with records that should have a consecutive number > ID (Check Register). Also has other records (deposits and adjusting > entries) that don't fit in the number range so autonumbering isn't
the > answer. I want to check to see if any check numbers are missing
from > the register, but can't figure out how to accomplish it. Thanks for > any help.

"CDB" <al***@delete.wave.co.nz> wrote in message news:<c5**********@news.wave.co.nz>...

It's a bit late for the original poster perhaps, but the following can also be used:

Table: Ones Field: Ordinal Values: 0 - 9 (10 rows)

Table: CheckRegister Field: CheckID Values: 1117658 to 1117698 with a few deletions.

Query: SELECT N.L AS Missing FROM CheckRegister RIGHT JOIN [SELECT 111*10^4+[O3].[Ordinal]*10^3+[O2].[Ordinal]*10^2+[O1].[Ordinal]*10+[O0].[Ord inal] AS L FROM Ones AS O0, Ones AS O1, Ones AS O2, Ones AS O3 WHERE (((111*10^4+[O3].[Ordinal]*10^3+[O2].[Ordinal]*10^2+[O1].[Ordinal]*10+[O0].[ Ordinal]) Between 1117658 And 1117698))]. AS N ON CheckRegister.CheckID = N.L WHERE (((CheckRegister.CheckID) Is Null));

The "Ones" have only a Cartesian join. This creates for seven places a rather large initial resultset, requiring many seconds. So the generated number has been shortened to 4 digits, with the common "111" set as a constant value. The above takes less than a second to run (1.2GHz).

Wow. Or, you could write a few lines of code:

sub showmissing()

dim rst as recordset
dim intStart as integer
dim intEnd as integer
dim i as integer

set rst = currentdb.openrecordset("mytable", dbopendynaset)

for i = intStart to intEnd
rst.findfirst "CheckID = " & i
if rst.nomatch then debug.print "CheckID ";i;" not found."
next i

Bruce, you are quite right, of course, but you understate your case
somewhat.

I avoid using code in an RDB if tables and queries will do the job.

My solution can be modified to run as a stored proc in SQLServer - no front
end activity.

My resultset can be used "as is" to source a form for the user. (Your code
requires more lines to get to that stage.)

Your code needs fixing and extending to bring it to a commercial level.
(More code, more lines.)

The posting was more of an illustration of creating a sequence of numbers in
SQL, rather than using the first responder's suggestion of a table with
"all" the required numbers. I use the n*10^x approach regularly eg for users
to "add a year of days" to a business calendar.

It's a bit late for the original poster perhaps, but the following can
also be used:

Table: Ones Field: Ordinal Values: 0 - 9 (10 rows)

Table: CheckRegister Field: CheckID Values: 1117658 to 1117698 with a few deletions.

Query: SELECT N.L AS Missing FROM CheckRegister RIGHT JOIN [SELECT
111*10^4+[O3].[Ordinal]*10^3+[O2].[Ordinal]*10^2+[O1].[Ordinal]*10+[O0].[Ord inal] AS L FROM Ones AS O0, Ones AS O1, Ones AS O2, Ones AS O3 WHERE
(((111*10^4+[O3].[Ordinal]*10^3+[O2].[Ordinal]*10^2+[O1].[Ordinal]*10+[O0].[ Ordinal]) Between 1117658 And 1117698))]. AS N ON CheckRegister.CheckID
= N.L WHERE (((CheckRegister.CheckID) Is Null));

The "Ones" have only a Cartesian join. This creates for seven places a rather large initial resultset, requiring many seconds. So the generated number has been shortened to 4 digits, with the common "111" set as a constant value. The above takes less than a second to run (1.2GHz).

Wow. Or, you could write a few lines of code:

sub showmissing()

dim rst as recordset dim intStart as integer dim intEnd as integer dim i as integer

set rst = currentdb.openrecordset("mytable", dbopendynaset)

for i = intStart to intEnd rst.findfirst "CheckID = " & i if rst.nomatch then debug.print "CheckID ";i;" not found." next i