[ADODC]: no RecordSource specified. [ADO] :Command text was not set for the command object

adovb6

below is the code which I am using

Private Sub Form_Load()
    On Error Resume Next

    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Smart Invoice\Smartdata.mdb;Persist Security Info=False"
    Adodc1.RecordSource = "Select * From tableSerMast"

End Sub

I am getting below said error:

[ADODC]: no RecordSource specified. [ADO] :Command text was not set for the command object

Best Answer

I am going to assume VBA, it should not be too difficult to change to VB6, if that is what you mean.

 Private Sub Form_Load()
    ''Almost never a good idea
    ''On Error Resume Next
    ''Reference: Microsoft ActiveX Data Objects x.x Library
    Dim adodc1 As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
        & "Data Source=D:\Smart Invoice\Smartdata.mdb;" _
        & "Persist Security Info=False"
    Adodc1.Open

    rs.Open "Select * From tableSerMast", Adodc1
End Sub
Related Topic