search two fields

  • Thread starter Thread starter Striker
  • Start date Start date
S

Striker

have a table that may contain the information I want to find in one of two
fields. Either the history, or the notes field. So in the query I can
enter a search criteria in the notes field as follows Like "*" & [Enter
Search String] & "*"

Is it possible to make the history field equal what the user inputs in the
notes search box, currently they are entering the same information twice
once for each field before the query runs.
 
You can easily enter your search string into a textbox on a form then
put the following in the criteria of each of the fields in question:

Like "*" & [frmMyform!MyTextBox] & "*"

Don't close that form until after your query has run.

HTH
 
have a table that may contain the information I want to find in one of two
fields. Either the history, or the notes field. So in the query I can
enter a search criteria in the notes field as follows Like "*" & [Enter
Search String] & "*"

Is it possible to make the history field equal what the user inputs in the
notes search box, currently they are entering the same information twice
once for each field before the query runs.

Sure; just use exactly the same criterion on both fields. Put the expression
on *two separate rows* of the query grid so that it uses OR logic (returning
the record if the value exists in either one of the fields).
 
yes, but I was trying to avoid having the user type the same thing twice.

John W. Vinson said:
have a table that may contain the information I want to find in one of
two
fields. Either the history, or the notes field. So in the query I can
enter a search criteria in the notes field as follows Like "*" & [Enter
Search String] & "*"

Is it possible to make the history field equal what the user inputs in the
notes search box, currently they are entering the same information twice
once for each field before the query runs.

Sure; just use exactly the same criterion on both fields. Put the
expression
on *two separate rows* of the query grid so that it uses OR logic
(returning
the record if the value exists in either one of the fields).
 
Did you try John's solution? If you did as he said and entered the
exact same prompt in the two rows, you will be asked only once. If you
are asked twice, then you did not enter the exact same prompt.

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

yes, but I was trying to avoid having the user type the same thing twice.

John W. Vinson said:
have a table that may contain the information I want to find in one of
two
fields. Either the history, or the notes field. So in the query I can
enter a search criteria in the notes field as follows Like "*" & [Enter
Search String] & "*"

Is it possible to make the history field equal what the user inputs in the
notes search box, currently they are entering the same information twice
once for each field before the query runs.
Sure; just use exactly the same criterion on both fields. Put the
expression
on *two separate rows* of the query grid so that it uses OR logic
(returning
the record if the value exists in either one of the fields).
 
OK, it took a while to hit, but it works.

Thank you

John Spencer said:
Did you try John's solution? If you did as he said and entered the exact
same prompt in the two rows, you will be asked only once. If you are
asked twice, then you did not enter the exact same prompt.

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

yes, but I was trying to avoid having the user type the same thing twice.

John W. Vinson said:
have a table that may contain the information I want to find in one of
two
fields. Either the history, or the notes field. So in the query I can
enter a search criteria in the notes field as follows Like "*" &
[Enter
Search String] & "*"

Is it possible to make the history field equal what the user inputs in
the
notes search box, currently they are entering the same information
twice
once for each field before the query runs.

Sure; just use exactly the same criterion on both fields. Put the
expression
on *two separate rows* of the query grid so that it uses OR logic
(returning
the record if the value exists in either one of the fields).
 
You can remember that you need to look in "one of two fields" to find a
particular type of data. Will your users? Will whoever replaces you as the
maintainer of the database? For that matter, will you, six months from
now?!

If the value you are searching for could be in Field1 or in Field2, perhaps
your data structure would benefit from a bit more normalization...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top