By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,486 Members | 2,067 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,486 IT Pros & Developers. It's quick & easy.

Making a "Find" button

P: n/a
Hey all,
I would like to make a command button on a form that lets you enter a
users name, and then if finds and displays only the records from that
user in the same form. I've tried doing it via a filter, but I'm not
sure im doing it correctly.

Thanks!!
Mark

Jan 3 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
radink wrote:
I would like to make a command button on a form that lets you enter a
users name, and then if finds and displays only the records from that
user in the same form. I've tried doing it via a filter, but I'm not
sure im doing it correctly.
One thing you have to be careful of is if you actually have the data that
you want to filter on in your form's Recordsource. Is the UserName field
being displayed with a ComboBox or is the table using a (ugh) Lookup field?
In those cases you might see one thing on your form, while the actual data
in the table is something else (like an ID number). The filter obviously
needs to filter on what is actually there, not necessarily what you see.

If what you are seeing is the actual data then a filter should work. You
can apply one with a command button with the following code...

Dim NameFilter as String
NameFilter = InputBox("Enter Name to Filter On")

If NameFilter <"" Then
Me.Filter = "NameField = '" & NameFilter & "'"
Me.FilterOn = True
End If

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 3 '07 #2

P: n/a
Rick,

Thanks. As usual I fired this off before looking further. I just made a
button that ran a macro that runs the Filter By Form command. I gotta
stop doing that.

Anyhow, since I have this working, what I would like to do is once the
use hits that, then they enter the criteria. They have to go up and hit
the apply filter button. This is ok, but what I would really like to do
is add another button right on the form that does the same thing. The
problem is that all of the buttons get grayed in the filter by form
mode. Any ideas on this?

I appreciate your help!!
Thanks
Mark

Rick Brandt wrote:
radink wrote:
I would like to make a command button on a form that lets you enter a
users name, and then if finds and displays only the records from that
user in the same form. I've tried doing it via a filter, but I'm not
sure im doing it correctly.

One thing you have to be careful of is if you actually have the data that
you want to filter on in your form's Recordsource. Is the UserName field
being displayed with a ComboBox or is the table using a (ugh) Lookup field?
In those cases you might see one thing on your form, while the actual data
in the table is something else (like an ID number). The filter obviously
needs to filter on what is actually there, not necessarily what you see.

If what you are seeing is the actual data then a filter should work. You
can apply one with a command button with the following code...

Dim NameFilter as String
NameFilter = InputBox("Enter Name to Filter On")

If NameFilter <"" Then
Me.Filter = "NameField = '" & NameFilter & "'"
Me.FilterOn = True
End If

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 3 '07 #3

P: n/a
radink wrote:
Rick,

Thanks. As usual I fired this off before looking further. I just made
a button that ran a macro that runs the Filter By Form command. I
gotta stop doing that.

Anyhow, since I have this working, what I would like to do is once the
use hits that, then they enter the criteria. They have to go up and
hit the apply filter button. This is ok, but what I would really like
to do is add another button right on the form that does the same
thing. The problem is that all of the buttons get grayed in the
filter by form mode. Any ideas on this?
Users have zero access to your buttons in Filter-By-Form view.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 3 '07 #4

P: n/a
I was afraid of that.

Is there a way to show some text on the form only in that view? Like
"press control whatever to continue"?
Rick Brandt wrote:
radink wrote:
Rick,

Thanks. As usual I fired this off before looking further. I just made
a button that ran a macro that runs the Filter By Form command. I
gotta stop doing that.

Anyhow, since I have this working, what I would like to do is once the
use hits that, then they enter the criteria. They have to go up and
hit the apply filter button. This is ok, but what I would really like
to do is add another button right on the form that does the same
thing. The problem is that all of the buttons get grayed in the
filter by form mode. Any ideas on this?

Users have zero access to your buttons in Filter-By-Form view.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 3 '07 #5

P: n/a
radink wrote:
I was afraid of that.

Is there a way to show some text on the form only in that view? Like
"press control whatever to continue"?
Not that I'm aware of. I think this becomes a "training issue".

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 3 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.