Serial Number

G

George

Hi all,

I have a macro to export to Excel a table (MS-Access). I have a field
called Sn in which I need to record serial numbers in Excel. I want to be
asked by running the query (through the macro) the starting number, e.g. 10
and then if i export ten records in this column to be filled serially 10, 11,
12.. 19.

Any idea of how can I do this?

Thank you in advance,

George
 
J

John Spencer

Sounds as if you need a ranking query as the export query and then need to
add 10 to the ranking using a parameter prompt.

Since you've not posted any details on the query or the fields involved this
is about all the detail I can give you.

Field: SN: [Enter Start Number]-1 + DCount("*","YourSourceTable","<<<Some
Where Clause>>>")

Google ranking query to get some ideas or post the SQL text of your query

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message

That may be enough for someone to help you build the proper query.
 
G

George

Dear John, This is my SQL:

SELECT "" AS sn, T_Applications.Marking
FROM T_Applications
WHERE (((T_Applications.Marking)>50));

And I need to fill the field sn with a serial number (starting with the
number it will ask me)

Thank you

Ο χÏήστης "John Spencer" έγγÏαψε:
Sounds as if you need a ranking query as the export query and then need to
add 10 to the ranking using a parameter prompt.

Since you've not posted any details on the query or the fields involved this
is about all the detail I can give you.

Field: SN: [Enter Start Number]-1 + DCount("*","YourSourceTable","<<<Some
Where Clause>>>")

Google ranking query to get some ideas or post the SQL text of your query

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message

That may be enough for someone to help you build the proper query.

George said:
Hi all,

I have a macro to export to Excel a table (MS-Access). I have a field
called Sn in which I need to record serial numbers in Excel. I want to be
asked by running the query (through the macro) the starting number, e.g.
10
and then if i export ten records in this column to be filled serially 10,
11,
12.. 19.

Any idea of how can I do this?

Thank you in advance,

George
 
J

John Spencer

OK, why no order by clause? Second, is Marking a unique field? If not,
what is the name of your primary key and what type of data is it.

Assumption:
Marking is unique value in the table

Parameters [Enter Start Number] Long;
SELECT [Enter Start Number] - 1 +
DCount("Marking","T_Applications","Marking>50 and Marking <=" &
T_Applications.Marking) as SN, Marking
FROM T_Applications
WHERE T_Applications.Marking>50
ORDER BY Marking


George said:
Dear John, This is my SQL:

SELECT "" AS sn, T_Applications.Marking
FROM T_Applications
WHERE (((T_Applications.Marking)>50));

And I need to fill the field sn with a serial number (starting with the
number it will ask me)

Thank you

? ??????? "John Spencer" ???????:
Sounds as if you need a ranking query as the export query and then need
to
add 10 to the ranking using a parameter prompt.

Since you've not posted any details on the query or the fields involved
this
is about all the detail I can give you.

Field: SN: [Enter Start Number]-1 + DCount("*","YourSourceTable","<<<Some
Where Clause>>>")

Google ranking query to get some ideas or post the SQL text of your query

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message

That may be enough for someone to help you build the proper query.

George said:
Hi all,

I have a macro to export to Excel a table (MS-Access). I have a field
called Sn in which I need to record serial numbers in Excel. I want to
be
asked by running the query (through the macro) the starting number,
e.g.
10
and then if i export ten records in this column to be filled serially
10,
11,
12.. 19.

Any idea of how can I do this?

Thank you in advance,

George
 
G

George

Thanks a lot my friend,

It works but not perfectly because the marking field is not a unique field.

Any more good ideas?

Thanks again

George

Ο χÏήστης "John Spencer" έγγÏαψε:
OK, why no order by clause? Second, is Marking a unique field? If not,
what is the name of your primary key and what type of data is it.

Assumption:
Marking is unique value in the table

Parameters [Enter Start Number] Long;
SELECT [Enter Start Number] - 1 +
DCount("Marking","T_Applications","Marking>50 and Marking <=" &
T_Applications.Marking) as SN, Marking
FROM T_Applications
WHERE T_Applications.Marking>50
ORDER BY Marking


George said:
Dear John, This is my SQL:

SELECT "" AS sn, T_Applications.Marking
FROM T_Applications
WHERE (((T_Applications.Marking)>50));

And I need to fill the field sn with a serial number (starting with the
number it will ask me)

Thank you

? ??????? "John Spencer" ???????:
Sounds as if you need a ranking query as the export query and then need
to
add 10 to the ranking using a parameter prompt.

Since you've not posted any details on the query or the fields involved
this
is about all the detail I can give you.

Field: SN: [Enter Start Number]-1 + DCount("*","YourSourceTable","<<<Some
Where Clause>>>")

Google ranking query to get some ideas or post the SQL text of your query

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message

That may be enough for someone to help you build the proper query.

Hi all,

I have a macro to export to Excel a table (MS-Access). I have a field
called Sn in which I need to record serial numbers in Excel. I want to
be
asked by running the query (through the macro) the starting number,
e.g.
10
and then if i export ten records in this column to be filled serially
10,
11,
12.. 19.

Any idea of how can I do this?

Thank you in advance,

George
 
J

John Spencer

If you don't have a field or a combination of fields to uniquely identify
each record then I have no further ideas.


George said:
Thanks a lot my friend,

It works but not perfectly because the marking field is not a unique
field.

Any more good ideas?

Thanks again

George

? ??????? "John Spencer" ???????:
OK, why no order by clause? Second, is Marking a unique field? If not,
what is the name of your primary key and what type of data is it.

Assumption:
Marking is unique value in the table

Parameters [Enter Start Number] Long;
SELECT [Enter Start Number] - 1 +
DCount("Marking","T_Applications","Marking>50 and Marking <=" &
T_Applications.Marking) as SN, Marking
FROM T_Applications
WHERE T_Applications.Marking>50
ORDER BY Marking


George said:
Dear John, This is my SQL:

SELECT "" AS sn, T_Applications.Marking
FROM T_Applications
WHERE (((T_Applications.Marking)>50));

And I need to fill the field sn with a serial number (starting with the
number it will ask me)

Thank you

? ??????? "John Spencer" ???????:

Sounds as if you need a ranking query as the export query and then
need
to
add 10 to the ranking using a parameter prompt.

Since you've not posted any details on the query or the fields
involved
this
is about all the detail I can give you.

Field: SN: [Enter Start Number]-1 +
DCount("*","YourSourceTable","<<<Some
Where Clause>>>")

Google ranking query to get some ideas or post the SQL text of your
query

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message

That may be enough for someone to help you build the proper query.

Hi all,

I have a macro to export to Excel a table (MS-Access). I have a
field
called Sn in which I need to record serial numbers in Excel. I want
to
be
asked by running the query (through the macro) the starting number,
e.g.
10
and then if i export ten records in this column to be filled
serially
10,
11,
12.. 19.

Any idea of how can I do this?

Thank you in advance,

George
 
Top