Formula to give squense number

K

K

Hi all, I have query with the name "Data" and in this query I have one
column
with the name "Ref" and in that column I have values like see below

Ref………col heading
bbc
bbc
bbc
msn
msn
google
google
google
google

In query design view I need some kind of formula in next column of
"Ref" column that when I run query then I should get result like
see
below

Ref Num………col heading
bbc 1
bbc 1
bbc 1
msn 2
msn 2
gog 3
gog 3
gog 3
gog 3

Basically I am trying to give number to the matching values in "Ref"
column but It should be in a way that first matchin value should have
number 1 and next matching values should have number 1 + 1. Hope I
was able to explain my question. Please can any friend can help
 
B

Bob Barrows

K said:
Hi all, I have query with the name "Data" and in this query I have one
column
with the name "Ref" and in that column I have values like see below

Ref………col heading
bbc
bbc
bbc
msn
msn
google
google
google
google

In query design view I need some kind of formula in next column of
"Ref" column that when I run query then I should get result like
see
below

Ref Num………col heading
bbc 1
bbc 1
bbc 1
msn 2
msn 2
gog 3
gog 3
gog 3
gog 3

Basically I am trying to give number to the matching values in "Ref"
column but It should be in a way that first matchin value should have
number 1 and next matching values should have number 1 + 1. Hope I
was able to explain my question. Please can any friend can help


No, this will not be a simple solution. For one thing, how are these
rows ordered? Certainly not alphabetically. There must be another field
you are not showing us that is providing that sort order. If so, it
might be possible to create a separate query that generates that
sequence number, allowing you to join this query to that one to produce
your desired results, but my preference would be to forget about doing
this in the query and use a report to generate those sequence numbers.
It's versy simple, create a report that uses this query as its record
source and groups by the Ref field. Then in the group header, add a
textbox with a controlsource: =1. Set the RunningSum property to "Over
Group". Run the report.
 

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