473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Finding out of sequence 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.
Nov 12 '05 #1
6 4584
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.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"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.

Nov 12 '05 #2
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.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"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.

Nov 12 '05 #3
Thanks for the courtesy of a thank you!!

Steve
"GSpiggle" <ga***@yahoo.com> wrote in message
news:de**************************@posting.google.c om...
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.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"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.

Nov 12 '05 #4
CDB
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).

Clive

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:oJ*****************@newsread2.news.atl.earthl ink.net...
Thanks for the courtesy of a thank you!!

Steve
"GSpiggle" <ga***@yahoo.com> wrote in message
news:de**************************@posting.google.c om...
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.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"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.


Nov 12 '05 #5
"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

end sub
rst.close
Nov 12 '05 #6
CDB
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.

With all due deference to the ancient wise...

Clive

"Bruce" <br***@aristotle.net> wrote in message
news:d3**************************@posting.google.c om...
"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

end sub
rst.close

Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: PhilC | last post by:
Hi Folks, If I have an array holding a pair of numbers, and that pairing is unique, is there a way that I can find the array index number for that pair? Thanks, PhilC
3
by: peterbe | last post by:
In a text that contains references to numbers like this: #583 I want to find them with a regular expression but I'm having problems with the hash. Hopefully this code explains where I'm stuck: ...
6
by: GSpiggle | last post by:
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...
32
by: someone else | last post by:
hi all I'm a newbie to this group. my apologies if I break any rules. I've wrote a simple program to find the first 1,000,000 primes, and to find all primes within any range (up to 200 *...
4
by: Kamran K | last post by:
Hello I have created a client server application using C#. Existing application is using random number on client side to generate sequence numbers that are then assigned to transactions. This...
5
by: Eric E | last post by:
Hi, I have a question about sequences. I need a field to have values with no holes in the sequence. However, the values do not need to be in order. My users will draw a number or numbers from...
13
by: athiane | last post by:
I want a way to parse out all function names that appear in a couple of C files. When the parsing logic finds a function name in a file, it should print out the Function name, line number and file...
2
by: raylopez99 | last post by:
Here is a short program demonstrating using IEnumberable, Linq, predicates, extension methods and some tricks and how to convert an IEnumberable sequence into an array. For future reference, not...
8
by: Slaunger | last post by:
Hi all, I am a Python novice, and I have run into a problem in a project I am working on, which boils down to identifying the patterns in a sequence of integers, for example ..... 1 6 6 1 6 6...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.