FindRecord Action to search a specified field (Access 200)

G

Guest

Is there a way of using the FindRecord Action within a macro to search a
specific field in a table for a record (in Access 2000)?

I have a relatively basic staffing database that details staff's personal
details (e.g. first name, surname, address, etc.). I need a macro to search
for specific records within one of the tables and then perform other actions
(e.g. print the record, mail merge the data, etc.).

As far as I can see the FindRecord action does not allow you to specify
which field you would like to search in. (In my case I would want to search
the [Surname] field.) Is there any way of doing this with the FindRecord
action, or should I try something else?

Many thanks
Richard
 
G

Guest

I believe you can add the field you want to use the action by adding and
using the Condition Column. Right Click on the Macro title bar and add
Condition, then specify the field.
 
S

Steve Schapel

Richard,

The FindRecord action in a macro is almost always associated with a
GoToControl action in advance. Let's say you have an unbound textbox or
combobox in the Form Header section of your form, where you would enter
the surname you are searching for. Let's say this control is named
FindSurname. So your macro, probably on the After Update event of this
FindSurname control, would be like this...
Action: GoToControl
Control Name: [Surname]
Action: FindRecord
Find What: =[FindSurname]
 
G

Guest

Richard,
I solve the problem you are mentionning by 2 things.
1. I search "the record" by creating an "overall" macro eg "FindWhat"
action: runcommand
command: find
this macro is actionned by a "double click" event in (all) those fields
where I suppose I will do regular search actions. It searches directly only
in the field where you activated the "search" macro (firstname, name,
function or whatsoever). This works also in fields with "dropdown" menus.
In my tools, options, find/edit-tab I standard set the "find behaviour" on
"start of field".
Above that (only for an easy use by non access-people) the background of the
field where this macro can run, is coloured (in my case yellow).

2. for the printing problem (or others) I foresee a button for this specific
action, where in my "print"macro I include the (a unique key) primary-key
value of the selected record as a condition
something like this: forms![StaffIn]!PrimaryKey= PrimaryKey
where StaffIn is the form where you performed the search action.
This will print only your active record
regards,
Cram
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top