Detailed serach

  • Thread starter Thread starter Pietro
  • Start date Start date
P

Pietro

Hi,

I've a form called 'assist' and an unbound control called 'value',
I want users to type a part of a word in the 'value' control to open the
form 'search' whaere the field 'Issue type' contains a part of the
'value'field....
Example: if users write "password" in the field 'value' the form 'serach
shows all records where the word "password" is included in the 'issue type'
field whether it's included at the beginning of the field or at the end or in
between...
How can i do this?
 
Pietro said:
Hi,

I've a form called 'assist' and an unbound control called 'value',
I want users to type a part of a word in the 'value' control to open the
form 'search' whaere the field 'Issue type' contains a part of the
'value'field....
Example: if users write "password" in the field 'value' the form 'serach
shows all records where the word "password" is included in the 'issue
type'
field whether it's included at the beginning of the field or at the end or
in
between...
How can i do this?


I've used my own form, control, and field names so that I could test the
code before posting ...

Private Sub cmdSearch_Click()
DoCmd.OpenForm "frmTarget", , , "TestText LIKE '*" & Me.txtSearch.Value
& "*'"
End Sub

"frmTarget" would be your "search" form, "TestText" would be your "Issue
type" field (you'll need square brackets around it because of the space in
the name) and "txtSearch" would be your "value" control.

BTW: "Value" is the name of a property (of fields and controls) so you may
possible experience some problems or unexpected behaviour if using it as a
control name.

See "LIKE Operator" in the help files for more information.
 
Back
Top