473,728 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4622
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 QryAllPossibleC heckNum based on the numbers table and in
the numbers field enter the criteria:
Between XXXStartCheckNu m And XXX EndCheckNum

3. Build a query named QryCheckNumOfPo stedCheck and in the CheckNum field enter
the criteria:
Between XXXStartCheckNu m 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
QryAllPossibleC heckNum that are not in (unmatched) QryCheckNumOfPo stedCheck.
This new query will return all missing check numbers.

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

"GSpiggle" <ga***@yahoo.co m> wrote in message
news:de******** *************** ***@posting.goo gle.com...
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.sp am> wrote in message news:<BP******* **********@news read3.news.atl. earthlink.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 QryAllPossibleC heckNum based on the numbers table and in
the numbers field enter the criteria:
Between XXXStartCheckNu m And XXX EndCheckNum

3. Build a query named QryCheckNumOfPo stedCheck and in the CheckNum field enter
the criteria:
Between XXXStartCheckNu m 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
QryAllPossibleC heckNum that are not in (unmatched) QryCheckNumOfPo stedCheck.
This new query will return all missing check numbers.

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

"GSpiggle" <ga***@yahoo.co m> wrote in message
news:de******** *************** ***@posting.goo gle.com...
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.co m> wrote in message
news:de******** *************** ***@posting.goo gle.com...
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.sp am> wrote in message

news:<BP******* **********@news read3.news.atl. earthlink.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 QryAllPossibleC heckNum based on the numbers table and in the numbers field enter the criteria:
Between XXXStartCheckNu m And XXX EndCheckNum

3. Build a query named QryCheckNumOfPo stedCheck and in the CheckNum field enter the criteria:
Between XXXStartCheckNu m 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
QryAllPossibleC heckNum that are not in (unmatched) QryCheckNumOfPo stedCheck.
This new query will return all missing check numbers.

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

"GSpiggle" <ga***@yahoo.co m> wrote in message
news:de******** *************** ***@posting.goo gle.com...
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.C heckID =
N.L
WHERE (((CheckRegiste r.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.sp am> wrote in message
news:oJ******** *********@newsr ead2.news.atl.e arthlink.net...
Thanks for the courtesy of a thank you!!

Steve
"GSpiggle" <ga***@yahoo.co m> wrote in message
news:de******** *************** ***@posting.goo gle.com...
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.sp am> wrote in message news:<BP******* **********@news read3.news.atl. earthlink.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 QryAllPossibleC heckNum based on the numbers table
and in the numbers field enter the criteria:
Between XXXStartCheckNu m And XXX EndCheckNum

3. Build a query named QryCheckNumOfPo stedCheck and in the CheckNum
field
enter the criteria:
Between XXXStartCheckNu m 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
QryAllPossibleC heckNum that are not in (unmatched) QryCheckNumOfPo stedCheck. This new query will return all missing check numbers.

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

"GSpiggle" <ga***@yahoo.co m> wrote in message
news:de******** *************** ***@posting.goo gle.com...
> 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.w ave.co.nz> wrote in message news:<c5******* ***@news.wave.c o.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.C heckID =
N.L
WHERE (((CheckRegiste r.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.openr ecordset("mytab le", 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***@aristotl e.net> wrote in message
news:d3******** *************** ***@posting.goo gle.com...
"CDB" <al***@delete.w ave.co.nz> wrote in message

news:<c5******* ***@news.wave.c o.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.C heckID = N.L
WHERE (((CheckRegiste r.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.openr ecordset("mytab le", 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
11729
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
1379
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: >>> import re >>> re.compile(r'\b(\d\d\d)\b').findall('#123 x (#234) or:#456 #6789') >>> re.compile(r'\b(X\d\d\d)\b').findall('X123 x (X234) or:X456 X6789') >>> re.compile(r'\b(#\d\d\d)\b').findall('#123 x (#234) or:#456 #6789')
6
446
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 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.
32
5115
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 * 10^12) it's pretty efficient, it took 15 minutes to compute the first 1,000,000 primes.
4
7729
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 results in duplicate sequence numbers across multiple users. Solution to this problem is to generate the sequence number on the server. Since this is not an ASP app, I cannot use Global.asax Application object to keep track of begin application.
5
3283
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 the sequence and write to the field. Sometimes, however, these sequence numbers will be discarded (after a transaction is complete), and thus available for use. During the transaction, however, any drawn numbers need to be unavailable. I would...
13
2008
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 in which the Function was found. What approach should i follow to tackle this problem ? Is there any option in the gcc compiler that prints out this information ?
2
2222
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 intended as a question. RL Main(): int numbers = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11};
8
2774
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 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0 3 3 0 3 3 0 10 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 6 6 1 9 3 3 0 3 3 0...
0
8904
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8759
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9424
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9198
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8133
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6718
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6013
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4524
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.