1

Hi I have problem whit excelvba & adodbe connection in local network i use below code from this link description

Sub tbl()

Dim myCn As MyServer
Set myCn = New MyServer

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

rs.Open "Select * from mytbl1", myCn.GetConnection

Range("A3").CopyFromRecordset rs

rs.Close
myCn.Shutdown

Set rs = Nothing
Set myCn = Nothing
End Sub

and vbaproject; how ever it work fine in my system, question here why it not work in other pcs in local network thanks lot

Community
  • 1
  • 1
Ali1356
  • 11
  • 2

1 Answers1

0

What you need is called Late Binding. Here is how to do it with the "ADODB.Recordset".

Sub tbl()

Dim rs As Object
Set rs = CreateObject("ADODB.Recordset")

End Sub

And here is some more information about it: https://msdn.microsoft.com/en-us/library/0tcf61s1.aspx

Pretty much, in late binding you do not have to refer to the library explicitly and it can run on any PC. In the early binding you have to do it. In the early binding you get IntelliSense as well.

Vityata
  • 42,633
  • 8
  • 55
  • 100