View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mr B[_2_] Mr B[_2_] is offline
external usenet poster
 
Posts: 29
Default Need ADO Recordset Help

I posted a question yesterday, and was not able to get the help I needed. I
have since tried several things to get a connection to the AS400 and return a
recordset using ADO.

I have now been able to actually make the connection without getting an
error, but when I attempt to get a recordset, I am still getting an error.

I would really appreciate some help.

Below is the code that I have now:

Dim strConn As String
Dim strSql As String
Dim myconn As ADODB.Connection
Dim rs As ADODB.Recordset

strConn = "Provider=MSDASQL.1; " _
& "Persist Security Info=False; " _
& "User ID=ACCTING; " _
& "Data Source=ACCOUNTING; " _
& "Initial Catalog=S408"
Set myconn = New ADODB.Connection
myconn.Open strConn

strSql = "SELECT * FROM BPCSF_GPM"

Set rs = New ADODB.Recordset
rs.Open (strSql), myconn

'here read some values from the recordset

rs.Close
myconn.Close

Mr B