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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I get the first record of a query?

Status
Not open for further replies.
Jun 20, 2003
40
GB
I have a query that selects a number of records, I only require the first record. Is there a way of getting the data from the queries first record into a variable so that I can populate an other table with the resulting data. This is all being done via a form that hopefully will be populated most of it automaticlly.

Any help on this would be most helpful.

Thanks in advance as I know someone will have the answer.
 
Leigh,

That's great but I have a number of fields in the query and I'd like to put each field into a seperate variable how do I do that?

Field1, Field2, Field3, Field4
10 10 10 10 <- Only need this line of data
10 10 10 11
10 10 10 12

Hope you can help further,

Cheers
 
Not sure if this would work, but it's worth a try...

INSERT INTO tblNewTable
VALUES (SELECT TOP 1 Field1, Field2, Field3, Field4 FROM tblCurrentTable WHERE Field1 = ???);

Not 100% sure if you can nest within an Append query but give it a go.

Leigh Moore
LJM Analysis Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top