Search Facility using text box (1 Viewer)

foxtet

Registered User.
Local time
Today, 09:11
Joined
May 21, 2011
Messages
129
Dear All
I want implement search facility using txtSearch. and btnReset.
the code is as follows. this doesnt work fine.
Any help is greatly appreciated.

foxtet

Private Sub cmdReset_Click()
Me!txtSearch.SetFocus
Dim strSearch As String
strSearch = "SELECT * FROM tbl_Entity_Info"
Call Form_Load
Call txtSearch_AfterUpdate
End Sub

Private Sub Form_Load()
Me!cmdReset.Enabled = False
Me!txtSearch.Value = "<all>"
End Sub
Private Sub txtSearch_AfterUpdate()
Dim strSearch As String
Dim strText As String

Me!cmdReset.Enabled = (Trim(Me!txtSearch & "") <> "<all>")
If Me!cmdReset.Enabled Then

strText = Me.txtSearch.Value
strSearch = "SELECT * FROM tbl_Entity_Info where ((EntityName like ""*" & strText & "*"")or (IslandName like ""*" & strText & "*"")or (AtollName like ""*" & strText & "*"")or (ContactStatus like ""*" & strText & "*""))"

End If

End Sub
 

Attachments

  • Search form.zip
    672.5 KB · Views: 52

bob fitz

AWF VIP
Local time
Today, 06:11
Joined
May 23, 2011
Messages
4,721
If you bind the form to a table then you can use the wizard to create a combo box to select the record to find. See the attached db.
 

Attachments

  • Search form Bob01.zip
    697 KB · Views: 57

Users who are viewing this thread

Top Bottom