473,511 Members | 14,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Present the 'gaps' in numbering

I need to find the 'gaps' in a numbered recordset like:
1 Philips
2 Jones
5 Jo Do
6 Frenzy
10 John Matthias
23 Arno R (and so on ....)

What I need is one blank line (or a line that says: " ... gap here ...." ) everytime a gap is found like:
1 Mr. Philips
2 Mrs. Jones

5 Jo Do
6 Frenzy

10 John Matthias

23 Arno R

What would be the most simple way to achieve this ?
I can do it by creating or using a temptable, but can it be done without the temptable?

Thanks
Arno R
Nov 13 '05 #1
5 1711
Hey pal,

If you to a loop for the max(recordsetCounter) and then check for a
valid line for each loop run through, where you don't find a record,
just return a gap here message into an output string.

I suppose it depends what you intend to do with the result set.

If you want a query to do this then i would use a code step to create a
recordset based on the max(recordsetCounter) and make a table of this
(basically a list of records containing only one field that is
effectively a 1 to n row autonumber.

Then you can create a query that links the two recordsets together and
using the correct join... left inner i think... you can return every
row and where null returns from the current recordset, you can dsiplay
yhe correct message.

Can you tell i'm sleepy and can't be arsed to write out code or
query...

Hope this helps you,

Rob.

Arno R wrote:
I need to find the 'gaps' in a numbered recordset like:
1 Philips
2 Jones
5 Jo Do
6 Frenzy
10 John Matthias
23 Arno R (and so on ....)

What I need is one blank line (or a line that says: " ... gap here ..." ) everytime a gap is found like:
1 Mr. Philips
2 Mrs. Jones

5 Jo Do
6 Frenzy

10 John Matthias

23 Arno R

What would be the most simple way to achieve this ?
I can do it by creating or using a temptable, but can it be done without the temptable?

Thanks
Arno R


Nov 13 '05 #2
Take a look at the "Mind the gap" section of my April 2004 Access Answers
column in Pinnacle Publication's Smart Access. You can download the column
(and accompanying sample database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Arno R" <ar***********@tiscali.nl> wrote in message
news:42*********************@dreader2.news.tiscali .nl...
I need to find the 'gaps' in a numbered recordset like:
1 Philips
2 Jones
5 Jo Do
6 Frenzy
10 John Matthias
23 Arno R (and so on ....)

What I need is one blank line (or a line that says: " ... gap here ..." )
everytime a gap is found like:
1 Mr. Philips
2 Mrs. Jones

5 Jo Do
6 Frenzy

10 John Matthias

23 Arno R

What would be the most simple way to achieve this ?
I can do it by creating or using a temptable, but can it be done without the
temptable?

Thanks
Arno R
Nov 13 '05 #3
Arno R <ar***********@tiscali.nl> wrote:
: I need to find the 'gaps' in a numbered recordset like:
: 1 Philips
: 2 Jones
: 5 Jo Do
: 6 Frenzy
: 10 John Matthias
: 23 Arno R (and so on ....)

: What I need is one blank line (or a line that says: " ... gap here ..." ) everytime a gap is found like:
: 1 Mr. Philips
: 2 Mrs. Jones

: 5 Jo Do
: 6 Frenzy

: 10 John Matthias

: 23 Arno R

: What would be the most simple way to achieve this ?
: I can do it by creating or using a temptable, but can it be done without the temptable?
I'd use a function like this:

dim prevrec as variant
dim gapcnt as integer

prevrec = first_recnum-1
gapcnt = 0

integer function fixgap(recnum as variant)

fixgap = 0

if recnum <> prevrec+1 then
gapcnt = gapcnt+1
else
if gapcnt > 0 then
fixgap = 1
end if

prevrec = recnum

end function

You'd need to figure out where to call the function and where to
define prevrec and gapcnt.
....but then again I *always* try to use code if I can get away w/ it.
--thelma
: Thanks
: Arno R
Nov 13 '05 #4
Nice article Doug, very helpful on the issue.
I will go for the strmsg-approach as I only need to 'present' the gaps (the first 5 perhaps)
Also the 'range-query' is very interesting!

Thanks, (also to Thelma and Rob)

Arno R

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> schreef in bericht news:XM********************@rogers.com...
Take a look at the "Mind the gap" section of my April 2004 Access Answers
column in Pinnacle Publication's Smart Access. You can download the column
(and accompanying sample database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Arno R" <ar***********@tiscali.nl> wrote in message
news:42*********************@dreader2.news.tiscali .nl...
I need to find the 'gaps' in a numbered recordset like:
1 Philips
2 Jones
5 Jo Do
6 Frenzy
10 John Matthias
23 Arno R (and so on ....)

What I need is one blank line (or a line that says: " ... gap here ...." )
everytime a gap is found like:
1 Mr. Philips
2 Mrs. Jones

5 Jo Do
6 Frenzy

10 John Matthias

23 Arno R

What would be the most simple way to achieve this ?
I can do it by creating or using a temptable, but can it be done without the
temptable?

Thanks
Arno R

Nov 13 '05 #5
"Arno R" <ar***********@tiscali.nl> wrote in
news:42*********************@dreader2.news.tiscali .nl:
I need to find the 'gaps' in a numbered recordset like:
1 Philips
2 Jones
5 Jo Do
6 Frenzy
10 John Matthias
23 Arno R (and so on ....)

What I need is one blank line (or a line that says: " ... gap here
..." ) everytime a gap is found like: 1 Mr. Philips
2 Mrs. Jones

5 Jo Do
6 Frenzy

10 John Matthias

23 Arno R

What would be the most simple way to achieve this ?
I can do it by creating or using a temptable, but can it be done
without the temptable?

Thanks
Arno R


Well, if you do this in a report, then...
select md.*, md1.id, md1.id as next_id
from MyData as MD left join MyData as MD1 on
md.id = (md1.id-1)

That should give you this set:

id, name, next_id
1, ..., 2
2, ..., <null>
5, ...., 6
6, ..., <null>
10,..., <null>
15

....and so on.

In a report, then, you want to add another control BELOW like this:

[detail=========================]
<id > <name ><nextid >
<nullplaceholder>

The <nullplaceholder> control should be a Text box that is bound to this
function: =iif(isnull([nextid]), " ", null), and set the CanGrow and
CanShrink properties.

This way, you don't have to do any funky formatting in the OnFormat event
handler for the Detail section.
Nov 13 '05 #6

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

Similar topics

2
4005
by: Andy Glew | last post by:
I have long looked for (and occasionally posted questions to groups such as this about) a tool that can take a group of HTML pages (nowadays XHTML, or XML) and produce a nicely formatted...
6
2835
by: Stanimir Stamenkov | last post by:
So if the 'type' attribute of the OL element is deprecated and authors should rely only on stylesheets how one could use a reference (as clear text) in the content to a particular list element? ...
6
7380
by: Christian Roth | last post by:
Hello, how do I offset the numbering of a list in XHTML Strict (+CSS) in current browsers? What I want is something like: 5. Item a 6. Item b 7. Item c
1
1898
by: Wayne Aprato | last post by:
I have a report that shows the results of a query. One of the fields is an autonumber field from the query which shows for instance: 120, 121 , 122 for 3 records. Is there a way to have another...
2
2293
by: Wayne Aprato | last post by:
I posted this yesterday and it seems like a moderator has thrown it in another thread. This is a totally different question to the one asked in that thread, so I'm posting it again. It is not a...
3
5760
by: Robert McGregor | last post by:
Hi there, I was wondering if anyone could help with this problem. I have a table with about 250,000 rows that relate to files that have been processed elsewhere in our business. Each file has...
3
2915
by: Jim Bancroft | last post by:
Hi all, In VB6 I used a 3rd party tool for line numbering my source code, to help with debugging. However, in experimenting with VB .Net I've noticed that my exceptions automatically provide...
54
3200
by: MLH | last post by:
I use A97 and do not always insert line numbers while writing procedures. I find it necessary to go back and add them later to aid in debugging. Nearly 3 years ago, something was mentioned in...
0
2052
by: [david] | last post by:
http://pyserial.sourceforge.net/ "port numbering starts at zero, no need to know the port name in the user program" But the implementation in SerialWin32 is just (Portnum +1)
0
7251
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,...
0
7148
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
7430
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...
1
7089
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...
0
7517
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
5673
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
3230
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...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.