View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
rodchar rodchar is offline
external usenet poster
 
Posts: 80
Default is there a way to do this

But then how does it get to Excel (the 2 specific columns)?

"Bob Phillips" wrote:

ADO? An example using Access

Sub GetData()
Const adOpenForwardOnly As Long = 0
Const adLockReadOnly As Long = 1
Const adCmdText As Long = 1
Dim oRS As Object
Dim sConnect As String
Dim sSQL As String
Dim ary

sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\bob.mdb"

sSQL = "SELECT LastName, FirstName From Contacts"
Set oRS = CreateObject("ADODB.Recordset")
oRS.Open sSQL, sConnect, adOpenForwardOnly, _
adLockReadOnly, adCmdText

' Check to make sure we received data.
If Not oRS.EOF Then
ary = oRS.getrows
MsgBox ary(0, 0) & " " & ary(1, 0)
Else
MsgBox "No records returned.", vbCritical
End If

oRS.Close
Set oRS = Nothing
End Sub


You can get connection strings from
http://www.carlprothman.net/Default.aspx?tabid=81

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"rodchar" wrote in message
...
hey all,

what's the best way to take all the records from 2 fields in a database

and
populate 2 specific columns in an excel spreadsheet?

thanks,
rodchar