Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using ADO to get the first 5 fields horizontaly
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using ADO to get the first 5 fields horizontaly
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 "Dan" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using ADO to get the first 5 fields horizontaly
Not working for me yet , do you maybe have the full code.
Many thanks, Dan "Mike" wrote: 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 "Dan" wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using ADO to get the first 5 fields horizontaly
Sorry, working now, was my Typo, many thanks.
DAN "Dan" wrote: 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using ADO to get the first 5 fields horizontaly
it would be better if you posted your code....
"Dan" wrote: Not working for me yet , do you maybe have the full code. Many thanks, Dan "Mike" wrote: 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 "Dan" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
fields names do not show in excel 2007 pivot table fields list | New Users to Excel | |||
I have a bar chart and i want to horizontaly align the datalabel | Charts and Charting in Excel | |||
Excel SHOULD NOT AUTO-CHANGE formated text fields to DATE FIELDS! | Excel Worksheet Functions | |||
Scroll horizontaly with mouse, create same system used to scroll . | New Users to Excel | |||
Catalogue of fields' connection whit external fields ( sheets) | Excel Programming |