Start from a sequence number on table pull every X records

L

lmn

I am using ACCESS 2002, I am not that strong in the VB aspect but can follow
already written code. I have a table which I have AutoNumbered; which is
working very well for this need. I am using this AutoNumber method as a
"sequence" number for data that have been sorted. I have a specific number
that I must start with (stored to a table), I then must add a "interval",
(stored to a table) to that number and pull every sequence number till end of
table. The Specific number and Interval can change in the future.

For example
Sequence number is = 750
Interval number is 2481.

I must pull sequence number 750, 3231, 5712 .... til end of file.

I have researched various ACCESS threads and VB Threads(which I am not
strong in). I just can't seem to find what I am looking for.
Any suggestions would be great. Thanks in advance for any help.
 
K

KARL DEWEY

Create a table CountNumber with field CountNUM containing numbers from 0
(zero) through your maximum sequence lenght. Substitute your table and field
name for [Change Requests].Primary_Key and enter interval and sequence at
prompts.
SELECT [Change Requests].Primary_Key
FROM [Change Requests], CountNumber
WHERE ((([Change Requests].Primary_Key)=([CountNUM]*[Enter interval])+[Enter
sequence]));
 
L

lmn

Thank you so much this is so close to what I have been looking for. I just
need to figure out how to pull the Interval from my tblInterval and the
Sequence from my tblSequence. I will eventually append this result to
another table containing the orginal sequence number and those that are from
this result....

KARL DEWEY said:
Create a table CountNumber with field CountNUM containing numbers from 0
(zero) through your maximum sequence lenght. Substitute your table and field
name for [Change Requests].Primary_Key and enter interval and sequence at
prompts.
SELECT [Change Requests].Primary_Key
FROM [Change Requests], CountNumber
WHERE ((([Change Requests].Primary_Key)=([CountNUM]*[Enter interval])+[Enter
sequence]));

--
KARL DEWEY
Build a little - Test a little


lmn said:
I am using ACCESS 2002, I am not that strong in the VB aspect but can follow
already written code. I have a table which I have AutoNumbered; which is
working very well for this need. I am using this AutoNumber method as a
"sequence" number for data that have been sorted. I have a specific number
that I must start with (stored to a table), I then must add a "interval",
(stored to a table) to that number and pull every sequence number till end of
table. The Specific number and Interval can change in the future.

For example
Sequence number is = 750
Interval number is 2481.

I must pull sequence number 750, 3231, 5712 .... til end of file.

I have researched various ACCESS threads and VB Threads(which I am not
strong in). I just can't seem to find what I am looking for.
Any suggestions would be great. Thanks in advance for any help.
 
J

John Spencer

A little math might work for you.

WHERE AutonumberField MOD [Interval] = [Sequence]
AND Autonumberfield >= [Sequence]

If Sequence is larger than interval



'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top