Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

ADO code does not work!!!!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ADO code does not work!!!!

    Hi, I have the following code for linking a worksheet to the as400 and it's not working.... Could someone help me!! I think I am not connecting it correctly. It's and iSeries... Library is QS36F File is PARTDESC PARTNO......is the number being entered in the worksheet FL002.......Hold the description... This is what I have so far. Option Explicit Public Sub GetPartNumbers() Dim myConn As ADODB.Connection Dim myRs As ADODB.Recordset Dim selVal As String Dim selRow As Integer Set myConn = New ADODB.Connection 'Is this connection to the 400 correct. myConn.ConnectionString = "Provider=IBMDA400;Data Source=XXX.XXX.X.X;User id=XXXXX;Password=XXXXX;" myConn.Open Set myRs = New ADODB.Recordset Dim R As Range Set R = Selection(1) 'cell as range that was clicked on If Intersect(R, Range("B14:B24")) Is Nothing Then MsgBox "You are not in Range (""B14:B24"")" Exit Sub End If selVal = Val(R.Value) 'Returned the number in the cell associated If selVal = 0 Then MsgBox "Select a Part Number then click on Get Part Number Command Button" Exit Sub End If 'Is the bottom code corredt myRs.Open "QS36F/PARTDESC/setvar((&PARTNO " & selVal & "))", myConn If myRs.RecordCount > 0 Then R.CopyFromRecordset myRs Else R.Offset(0, 2).Value = "No Records Returned" End If End Sub Thanks Jaime
Working...
X