Private Sub Form_Load() Dim s As String Dim k As Integer s = "Provider=Microsoft.Access.OLEDB.10.0;Data Source=MyServerName;Initial Catalog=DataBaseName;Uid=sa;Pwd=Password;trusted connection = yes;Data Provider=SQLOLEDB;" Dim aCon As ADODB.Connection Dim aRs As ADODB.Recordset Set aCon = New ADODB.Connection With aCon .Open s Set aRs = .Execute("SELECT * from AirCL2Loss_GNP_HU_TY13_Use.dbo.Sample") End With k = aRs.Fields.Count k = k - 1 Set Me.NewSubForm.Form.Recordset = aRs For x = 0 To k Form_Form1("NewSubForm")("Id" & x + 1).ControlSource = aRs(x).Name Form_Form1("NewSubForm")("Id" & x + 1 & "_Label").Caption = aRs(x).Name Form_Form1("NewSubForm")("Id" & x + 1).Visible = True If x = k Then Exit For Next End Sub
Error:Runtime error '-2147217843 (80040e4d)' Data Provider could not be intialized
"Provider=Microsoft.Access.OLEDB.10.0;Data Source=MyServerName;Initial Catalog=DataBaseName;Uid=sa;Pwd=Password;trusted connection = yes;Data Provider=SQLOLEDB;"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)