Use an unbound text box for the user to enter the value to find.
If you want to search 2 fields to find the value, you would build the
filter
string like this:
If Not IsNull(Me.txtWot2Find) Then
strWhere = strWhere & "(([Title] = """ & Me.txtWot2Find & _
""") OR ([LinkedInfo] = """ & Me.txtWot2Find & """)) AND "
End If
That's assuming you need to use this as part of the utility you referred
to
in your original post, which I think is:
http://allenbrowne.com/ser-62.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Sorry Allen,
Thanks for your help, this is the last bug in my database!!
The database is being used as a procedure manual of sorts for
electricity
faults. Users do not edit or load info (Only a Supervisor can add/edit
info
and this is done through another form).
They search a topic, say Damaged Street lights.
This appears on the form in Field 1 [Title] along with relevant info.
One of the fields ([Field 2] or [LinkedInfo]) is a bound field.
On many records [LinkedInfo] may be empty (no other pages with relevant
info
to the record being viewed) However, some pages may have the title to
another
record (in the example above "Installing New Street Lights".
Therefore when viewing the Damaged Street Lights record and the user
clicks
[LinkedInfo] the record changes now showing [Title] = Installing New
Street
Lights (as these two records are about the same topic). - Vice versa
"Installing New Street Lights" has "Damaged Street Lights" appearing in
its
[LinkedInfo] field.
I may have set this up wrong so any suggestions would be appreciated.
:
Not sure I understand what you are doing here.
Is Field2 *unbound*? If so, you are not entering a value to save,
merely
a
value to find.
Or is Field2 *bound* to a field? If so, entering something will save
to
that
field - proabaly not what you intend. Trying to use the one box to
filter
and enter data is likely to lead to confusion.
Or are you using Filter By Form or some other mode?
Or are you trying to use Filter By Selection?
Applying or removing a filter will have the effect of loading the form
again, and hence moving to the first record.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Thanks Allen,
I have tried that and it doesn't work as soon as the filter is
removed
the
form goes back to record 1 and it then doesn't know what was entered
in
Feild2 on the record that was being viewed (some records don't have
anything
in this field, others have the name of another record with a similar
topic)
Does this make sense??? Sometimes I tend to confuse myself!!
:
It makes sense that if the record you want is filtered out of the
form,
it
will not be found.
If you wish to remove the filter so the record can be found, add
this
line
above your code:
If Me.FilterOn Then Me.FilterOn = False
I have a DB that users access pages via Allen Browne's search
screen
(Thank
god for this! I was having troubles getting a keyword search to
work)
When users click on a result it comes up as filtered (record 1 of
1).
However on my form there is a text field that the user can click
on
to
take
them to another record thats of a similar topic to the record
they
are
currently using.
The below works when all records are 'viewable' but not when the
user
has
selected the record from the search screen.
DoCmd.GoToControl "Field1"
DoCmd.FindRecord Field2