can anyone help me out for creating a searching table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • haunter
    New Member
    • Oct 2013
    • 6

    can anyone help me out for creating a searching table

    Im doing a project on cyber cafe managment which needs search and it should search for name ,phone,date ....Theirs a constrain that if the names of the users are same then it has to give me all the users with the name :)
  • haunter
    New Member
    • Oct 2013
    • 6

    #2
    this is the code which i used...to search for a single attribute but i want the fields which are repeated to be shown along wit it
    Code:
    Dim rs As New ADODB.Recordset
    Dim cn As New ADODB.Connection
    
    Private Sub cmdsearch_Click()
    If txtsearch = "" Then
    MsgBox "invalid search keyword", vbCritical, "book"
    Exit Sub
    End If
    cn.Open
    rs.Open "select * from s5 where name='" & txtsearch & "' or phone='" & txtsearch & "' or d1='" & txtsearch & "'", cn, adOpenDynamic, adLockOptimistic
    If rs.EOF And rs.BOF Then
    MsgBox "item doesnot exist", vbCritical, "book"
    Else
    lblsearch.Caption = "Name:" + rs!Name + vbNewLine + "Phone Number:" + rs!phone + vbNewLine + "Date:" + rs!d1
    End If
    rs.Close
    cn.Close
    End Sub
    
    Private Sub Form_Load()
    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    cn.ConnectionString = "Provider=MSDAORA.1;Password=tiger;User ID=system;Persist Security Info=True"
    End Sub
    Last edited by Rabbit; Oct 22 '13, 03:56 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Please use code tags when posting code or formatted data.

      I don't know what you mean by "the fields that are repeated"

      Comment

      • CyberSoftHari
        Recognized Expert Contributor
        • Sep 2007
        • 488

        #4
        Use sql query to do
        Sample:
        Code:
           strSql = "Select * from TableName Where searchField1 like '" & strSearchString & "%' or searchField2 like '" & strSearchString & "%'"
        Searching type differ for date, number and, text.
        Last edited by CyberSoftHari; Oct 23 '13, 03:04 PM. Reason: code tag

        Comment

        • haunter
          New Member
          • Oct 2013
          • 6

          #5
          thanks a lot !! :) well is there any way to get a round shape command button in vb?

          Comment

          Working...