Solved

Split Form with Criteria for Query Results

Posted on 2010-11-14
5
628 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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.

744 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

14 Experts available now in Live!

Get 1:1 Help Now