Hello Guys. Good Day!

Masters of programming out there anybody can read mo this code guys how it work in the program for better understanding of mine. Thanks in advance for your help...

br.

Private Sub cmdsearch_Click()
    On Error Resume Next
    Dim dok As String
    Dim ran As String
    dok = InputBox("Enter " & Combo1 & " to Search", "Searching")
    Adodc1.Recordset.Close
    ran = "Select * FROM addressbook where " & Combo1.List(Combo1.ListIndex) & " = '" & dok & "'"
    Adodc1.RecordSource = ran
    Adodc1.Refresh
    If Adodc1.Recordset.EOF Then
    MsgBox "No Record Found!", vbInformation
    End If

End Sub

and this code:

Private Sub cmdsearch_Click()
    On Error Resume Next
    Dim dok As String
    dok = InputBox("Enter " & Combo1 & " to Search", "Searching")
    Adodc1.Refresh
    Adodc1.Recordset.Find Combo1.List(Combo1.ListIndex) & " = '" & dok & "'"
    If Adodc1.Recordset.EOF Then
    MsgBox "No Record Found!", vbInformation
    For i = 0 To Combo1.ListCount - 1
    If i = Combo1.ListIndex Then DataGrid1.Columns(i).Visible = True
    Next i
    Else
    For i = 0 To Combo1.ListCount - 1
    If i = Combo1.ListIndex Then
    DataGrid1.Columns(i).Visible = True
    Else
    DataGrid1.Columns(i).Visible = False
    End If
    Next i
End Sub

and this code:

Private Sub Form_Load()
    Adodc1.CommandType = adCmdText
End Sub

Every VB6 control has a default value. For instance, the text box control's default value is text. So, if I just code say Text1, that would be equivalent to Text1.Text.

Combo1 has a default value. Find out what it is and that will help you out. It's probably text.

Other than that, you would have to say specifically which section of code is giving you problems. But the default values property can be confusing because it is not commonly known.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.