Solved

Split Form with Criteria for Query Results

Posted on 2010-11-14
5
679 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 85

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 19

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 85
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

724 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