Find a record?

P

PayeDoc

Hello All

Is it possible to find a record without having to filter for it?
i.e.
Having selected a value with combobox [find_who], I want to open the form
[frm_employees] in single-form view and then go to the record (there will
definitely only be one - or none!) where the field [employee] = the selected
[findwho] value - but I don't want [frm_employees] to be filtered only to
show that record, because I want the user to be able to go on to select
another [employee] from [frm_employees] without having to remove the filter
first.

Can this be done?

Thanks for any help.
Leslie Isaacs
 
P

pyxi_styx via AccessMonster.com

You can set the AfterUpdate property to run an embedded macro. For that Macro,
you'll want to set the action to OpenForm. The arguments will be:
Form Name: frm_employees
View: Form
Filter Name:
Where Condition: [employee]=[Forms]![main_form_name]![find_who]

This argument is saying "I want the employee record on frm_employees to open
the same employee I've entered in main_form_name's find_who box."

Hope this helps!
Ambyr
Hello All

Is it possible to find a record without having to filter for it?
i.e.
Having selected a value with combobox [find_who], I want to open the form
[frm_employees] in single-form view and then go to the record (there will
definitely only be one - or none!) where the field [employee] = the selected
[findwho] value - but I don't want [frm_employees] to be filtered only to
show that record, because I want the user to be able to go on to select
another [employee] from [frm_employees] without having to remove the filter
first.

Can this be done?

Thanks for any help.
Leslie Isaacs
 
A

Al Campagna

PayeDoc,
You can use the FindRecord method.
On my website, I have an A97 and A2003 sample file
called Combo Quick Find, that demonstrates how to find a record
from a combo selection.

Note: You should always use a unique key value to do the "find", not by
name.
Example EmployeeID, or CustID, etc...
I call my combo cboFindByName... but I really use the ID value to do the
find.
See my sample file as to how to select by name, but find by key field
value...

Basically, on the AfterUpdate event of your combo...

Private Sub cboFindName_AfterUpdate()
DoCmd.GoToControl "IDNo"
DoCmd.FindRecord cboFindName
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
P

PayeDoc

Hello Ambyr

That's great - many thanks
Les



pyxi_styx via AccessMonster.com said:
You can set the AfterUpdate property to run an embedded macro. For that Macro,
you'll want to set the action to OpenForm. The arguments will be:
Form Name: frm_employees
View: Form
Filter Name:
Where Condition: [employee]=[Forms]![main_form_name]![find_who]

This argument is saying "I want the employee record on frm_employees to open
the same employee I've entered in main_form_name's find_who box."

Hope this helps!
Ambyr
Hello All

Is it possible to find a record without having to filter for it?
i.e.
Having selected a value with combobox [find_who], I want to open the form
[frm_employees] in single-form view and then go to the record (there will
definitely only be one - or none!) where the field [employee] = the selected
[findwho] value - but I don't want [frm_employees] to be filtered only to
show that record, because I want the user to be able to go on to select
another [employee] from [frm_employees] without having to remove the filter
first.

Can this be done?

Thanks for any help.
Leslie Isaacs
 
P

PayeDoc

Hello "Al Campagna"

Great stuff - many thanks!
Les


Al Campagna said:
PayeDoc,
You can use the FindRecord method.
On my website, I have an A97 and A2003 sample file
called Combo Quick Find, that demonstrates how to find a record
from a combo selection.

Note: You should always use a unique key value to do the "find", not by
name.
Example EmployeeID, or CustID, etc...
I call my combo cboFindByName... but I really use the ID value to do the
find.
See my sample file as to how to select by name, but find by key field
value...

Basically, on the AfterUpdate event of your combo...

Private Sub cboFindName_AfterUpdate()
DoCmd.GoToControl "IDNo"
DoCmd.FindRecord cboFindName
End Sub
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

PayeDoc said:
Hello All

Is it possible to find a record without having to filter for it?
i.e.
Having selected a value with combobox [find_who], I want to open the form
[frm_employees] in single-form view and then go to the record (there will
definitely only be one - or none!) where the field [employee] = the
selected
[findwho] value - but I don't want [frm_employees] to be filtered only to
show that record, because I want the user to be able to go on to select
another [employee] from [frm_employees] without having to remove the
filter
first.

Can this be done?

Thanks for any help.
Leslie Isaacs
 

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