there are 3 things here: a search box named "test", an input box where a user
would typically enter information named [vessel], and of course the search
button that activates the macro.
Not quite sure what you're suggesting. the item being searched is whatever
the user types in the field name "test". It is to compare what the user typed
in "test" to the actual names listed in [vessel]. i.e. a database with vessel
names, search box has "bow", when search button is pressed, access will
scroll back to the latest record with the [vessel] name contains the word
"bow".
I took your suggestion assuming "test" as the control focus was incorrect,
and changed to [vessel] and clicking the search button continues to just
scroll back to previous record instead of skipping all records that don't
match the search criteria.
Tried other combinations:
gotocontrol findwhat
test =[Forms]![frmvessels]![test] DOESNT WORK
[vessel] =[Forms]![frmvessels]![vessel] DOESNT WORK
test =[Forms]![frmvessels]![vessel] DOESNT WORK
[vessel] =[Forms]![frmvessels]![test] DOESNT WORK
I don't know what to do... There has to be a way for someone to type
something and press search and make the record that matches appear?
Unfortunately I still haven't found the method in doing so....
KARL DEWEY said:
- mcrFind -
GoToControl: test
This is wrong. GoToControl: -- Enter the field that is to be searched.
--
Build a little, test a little.
Adam said:
I don't know how to open the macro in vba... but in macro builder it looks
like this:
- mcrFind -
GoToControl: test
FindRecord
Find What: =[Forms]![frmvessels]![test]
Match: Any Part of Field
Match Case: No
Search: Up
Search as formatted: Yes
Only Current Field: No
Find First: No
User is to type a vessel name in a text field named "test". He is then to
press a button that activates the macro above. The result should find search
results similiar to the vessal name the user input in the "test" field. The
record found should be the most recent record.
:
Ok, then the datatype is text.
I do not know what to check next but I would like you to post all the action
in your macro in their order and with condition if any.
--
Build a little, test a little.
:
It is the name of a ship. So, like searching the name of a person.
:
What is the datatype of the field you are searching?
If it is a date field then maybe try --
=CVDate([Forms]![frmvessels]![test])
--
Build a little, test a little.
:
Getting closer but still not functioning properly. When a word is typed into
the "test" box, and the button binded to the find macro is pressed, it just
goes to the previous record, and continues to go to the previous record each
time the button is pressed until a record matching the criteria is found.
How do I make it whenever you press the button, it skips all the records
that don't match the criteria and goes straight to the record that does match
the search criteria?
my parameters on the find record macro are as follows:
Find What: =[Forms]![frmvessels]![test]
Match: Any Part of Field
Match Case: No
Search: Up
Search as formatted: Yes
Only Current Field: No
Find First: No
:
I have the form open by default on a new record.
On a new record you will not find anything as all you have is a blank
record. You have to have a recordset to find something.
You do not put [Forms]![frmPlanes]![test] in the GoToControl field but the
name of the field you are searching.
Did you place an equal sign in front of [Forms]![frmPlanes]![test] in the
Find What?
--
Build a little, test a little.
:
I have the form open by default on a new record. Typed what I wanted to
search in my "test" box, pressed the macro button, and received that error
message: There is no field named '[Forms]![frmPlanes]![test]' in the current
record.
In my macro builder, I did what you told me, having:
[Forms]![frmPlanes]![test]
in the GoToControl field, and the same in the FindWhat field of the
FindRecord macro... what am I doing wrong?
:
If the cursor is not in the field then first you need GoToControl to have
focus on the text box. Reference it like this --
[Forms]![YourFormName]![TextBoxName]
Then in the FindWhat you enter the string, date, or whatever data you are
looking for in a record. In this case you use
[Forms]![YourFormName]![TextBoxName] in the FindWhat.
--
Build a little, test a little.
:
How do I reference my text box which is unbound? what is the expression I
should place in the FindWhat field in macro editor?
:
UNTESTED UNTESTED
Try FindRecord like this --
Find What - Reference your form text box
Match - Any part of field
Match Case - Your choice
Search - All
Search As Formated - No
Only Current Field - No
Find First - No
--
Build a little, test a little.
:
Hi,
I can't get the Find macro to work properly. I have a blank box on a form
where the user can type anything, press a "find" button, and the macro should
perform a search through the records based on the following criteria:
- Search all fields of the table (but I am willing to limit this to just a
few specific fields if it makes things easier, but note field that will be
searched may contain multiple records, i.e. search last name: smith)
- Search starting from the most recent record.
- The text or numbers used to perform the search are inputted by the user in
the blank box.
Please help. Thanks in advance.