Solved

Split Form with Criteria for Query Results

Posted on 2010-11-14
5
635 Views
Last Modified: 2012-05-10
I'm learning about forms and working on some real-life reasons to practice.  Can someone start me on the right track on this simple project:

I have a table with customer records.  I'd like to have a split form (or screen of some kind if it shouldn't be a split form) where the top portion has a text box for entering city.  And the bottom portion will display all the records from that city.

Any help in getting started is much appreciated.
0
Comment
Question by:BBlu
  • 2
  • 2
5 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 200 total points
ID: 34130382
You don't want to use a Split form for that. A Split Form shows the same data in 2 different views (a Detail view and a Master view).

Instead, just add an unbound Textbox (txSearch) and Command Button (cmSearch) to the Form Header, then add code like this in the Click event of cmSearch:

Me.Filter = "YourCityField='" & Me.txSearch & "'"
Me.FilterOn = True

You can also "clear" the filter like this:

Me.FilterOn = False
0
 
LVL 18

Assisted Solution

by:Richard Daneke
Richard Daneke earned 100 total points
ID: 34130863
The sample Task managerment database shows a couple of form techniques worth learning.
As relates to your question, a Search box is placed on the form that permits saving filters as they are used on forms.  This technique will let your users create and extend the use of filters as needed without coding!
I have attached a saved example (Task management database1), but it is available free from the Microsoft Office web site.
Task-management-database1.accdb
0
 

Author Comment

by:BBlu
ID: 34131976
That worked LSM.  And I'm going to open and learn about form techniques with the Task Management Database.  Can someone tell me how to get the form to appear like a datasheet? I got the filter to work.  But I'd like the results to appear like a datasheet, instead of one by one.
0
 
LVL 84
ID: 34132376
You can set the View to be Datasheet, but if you do I believe you lose the ability to use the Headers and Footers. You can use a Mainform/Subform setup, but this will make things a bit more tricky.

You can set the View to Continuous, which you can build to look very much like a Datasheet, and you can then use the Headers and Footers as always.
0
 

Author Closing Comment

by:BBlu
ID: 34133843
Thank you both for your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now