473,466 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Making a "Find" button

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
5 8002
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Galsaba | last post by:
I am trying to find a script to a "dealer locator" or "find a store near you". I will have two tables. One will include all US and Canada ZIPs including lat and longtitudes. The other one is a...
2
by: jon morgan | last post by:
Hi, Just how do you track down the location of an exception when all you get is a message saying "NullReferenceException occured in Unknown Module" ? It seems like the proverbial needle in a...
3
by: DLN | last post by:
I want to create a form page that has a single field on it, say "last name", and when that last name is entered in, I want to click a button and have it bring up another page with the results. Any...
3
by: Dmitry Jouravlev | last post by:
Hi, I have a number of C++ solutions in Visual Studio .NET and when i compile them using "Whole Program Optimization", certain projects report a LNK1171 error saying that c2.dll could not be...
2
by: Lenonardo | last post by:
Hi. I'm writing a VB.Net application to update multiple Excel Worksheets. I'm using late binding (i.e. all variables are objects + use createobject) I develop the application on an XP...
4
by: jim | last post by:
I'm trying to import a 625MB, tab-delimited .txt file into Access, but I keep receiving the following error after several minutes of what seem to be noble attempts by Access to render the data: ...
3
by: OJ | last post by:
Hi, I have added code to run on a button click event which adds usercontrols to an asp:Panel control held in a contentplaceholder defined by the masterpage. for (int x = 0; x <...
0
by: Rave | last post by:
This is a long shot, but I thought I'd try it. I am currently using excel as an inventory tool. I currently have a hand-held scanner plugged into a laptop for reading barcodes. Using the "Find and...
2
by: Winks | last post by:
In the 2003 version I was able to change the default "Look In" and "Match" settings for the Find dialog box. I have looked all over 2007 and cannot find where to set the defaults. Can anyone...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.