ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ADO Link does not work...help (https://www.excelbanter.com/excel-programming/283308-ado-link-does-not-work-help.html)

Jaime[_3_]

ADO Link does not work...help
 
Hi
Could someone look at my code and let me know what I am doing wrong...

Thank
Jaim

Option Explici

Public Sub GetPartNumbers(
Dim myConn As ADODB.Connectio
Dim myRs As ADODB.Recordse
Dim selVal As Strin
Dim selRow As Intege

Set myConn = New ADODB.Connectio
myConn.ConnectionString = "Provider=IBMDA400;Data Source=xxx.xxx.x.x;User id=xxxxx;Password=xxxxx;
myConn.Ope
Set myRs = New ADODB.Recordse

Dim R As Rang
Set R = Selection(1) 'cell as range that was clicked o

If Intersect(R, Range("B14:B24")) Is Nothing The
MsgBox "You are not in Range (""B14:B24"")
Exit Su
End I

selVal = Val(R.Value) 'Returned the number in the cell associate
If selVal = 0 The
MsgBox "Select a Part Number then click on Get Part Number Command Button
Exit Su
End I

myRs.Open "QS36F/PARTDESC/setvar((&PARTNO " & selVal & "))", myCon

If myRs.RecordCount 0 The
R.CopyFromRecordset myR
Els
R.Offset(0, 2).Value = "No Records Returned
End I

End Sub


All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com