Forms - program command button

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

Hi All,

I'm trying to build a command button that takes the
text/value insides the text box and do a search. When I
click the "search" command button, it graps the value from
the search textbox and search for the data base on the
value. Any suggestion??

Thanks,

mike
 
What do you want it to do once it searches the database? Is the
search textbox on the same form as the data you want to present? Or
do you want to open a new record. What do you want to do if there is
more than one record that matches the search criteria, or no matches?

--
HTH

Dale Fye


Hi All,

I'm trying to build a command button that takes the
text/value insides the text box and do a search. When I
click the "search" command button, it graps the value from
the search textbox and search for the data base on the
value. Any suggestion??

Thanks,

mike
 
Actually, when I type a keyword in the search text box and
click search and the result is listed in a combobox, Then
I can highlight the result in the combobox and click the
show record button to show the record in another form. But
I just need to know what is the code to grap the value in
the text box when I click on the searh button.

Thanks for the help..

Mike
 
You didn't say what you wanted to search for, so I'll assume this is a
client database.

You will need to do something like:

Public Sub cmdSearch_Click

Dim strSQL as string
strSQL = "SELECT ClientID, ClientName " _
& "FROM YourTable T "
& "WHERE T.ClientName LIKE " & CHR$(34) &
me.txtSearch.value & "*" & CHR$(34)
me.cboSomething.RowSource = strSQL
me.cboSomething.Requery

End Sub

--
HTH

Dale Fye


Actually, when I type a keyword in the search text box and
click search and the result is listed in a combobox, Then
I can highlight the result in the combobox and click the
show record button to show the record in another form. But
I just need to know what is the code to grap the value in
the text box when I click on the searh button.

Thanks for the help..

Mike
 
Back
Top