Using ADO to get the first 5 fields horizontaly

D

Dan

Hi,
I know how to retieve data via ADO from access.
But can I
1) retrieve only the first 5 first records of the result of SQL
2) display them in Excel horizontaly (First in A1, second in B1, third in
B3...)
Many thanks,
Dan
 
M

Mike

Try this
If (Not rs.BOF Or rs.EOF) Then
For i = 1 To 5
Cells(1, i) = rs.Fields("FieldName").Value
rs.MoveNext
Next i
End If
 

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