Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to select Specific Row in a table

Status
Not open for further replies.

kayek

Programmer
Jun 19, 2003
95
US
With Access 2000 is there a way to select a specific row in a table? For example, if I wanted all the columns from row 2 in table1 the SQL would be something like

SELECT * FROM tabel1 WHERE rownum = 2

but that does not work in Access.
 
What do you mean by rownum ?

In Relational databases the order of the rows in a table has no meaning whatsoever. ( That is actually a specific RULE )

In order to specify any particular row in a table, the table needs to have a "Primary Key" which is unique to that row.

( In a lot of simple applications many people just use an 'AutoNumber' field which automatically increments as each new record is added. )
To be fair - many other people decry the use of autonumbers and not being strictly complient with CODD Rules
But they are simple and ( with care ) effective.


So if rownum is a field ( Column Name ) within the table then your SQL string will work

But if you mean rownum in the loose way that Excel uses it - then No, Access won't allow you to make the sort of errors that that kind of referencing will cause.



'ope-that'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Try this:
Code:
SELECT table11.* FROM tabel1 WHERE rownum = 2;

That should work as far as format, but as far as rownum, don't know how to pull that, unless you are going to do something like:
WHERE table11.Field1 = "the value in 2nd row"

Also, try a cross-tab query (just a suggestion from a coworker here, b/c you can label your rows in Cross-tab queries..



Stephen [infinity]
"Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me." John 14:6 KJV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top