Solved

How make subform display only certain records

Posted on 2014-11-28
2
879 Views
Last Modified: 2014-11-28
I have a form that has a sub-form.  When the form opens (with the subform), I want only certain records to display in the subform. that relate to the ID in the main form.  

For of all the link between the 2 form is ID.  

But I want the subform to display only the records that have TRNX_TYPE being "I" (letter I, not 1), and DATE_RECD is not null

Its like the subform should open with:  TRNX_TYPE = "I" AND DATE_RECD is not null

How can I make the subform only display those records?
0
Comment
Question by:SteveL13
2 Comments
 
LVL 18

Accepted Solution

by:
Simon earned 500 total points
ID: 40470492
>>Its like the subform should open with:  TRNX_TYPE = "I" AND DATE_RECD is not null

Add a filter to the subform properties and set filter on load to true
((([TRNX_TYPE]="I"))) AND ([DATE_RECD] Is Not Null)

Or, add a where clause to the datasource query for the subform. If it's currently bound to a table, make the query
SELECT tblTransactions.*
FROM tblTransactions
WHERE (((TRNX_TYPE)="I") AND ((DATE_RECD) Is Not Null));

Open in new window


Which of these options you want depends on your scenario. If you use the filter option, it sets the initial load condition, but users can remove the filter to see the other records. If you do it with a WHERE clause then they can't
0
 
LVL 23

Expert Comment

by:Eirman
ID: 40470538
Copy the query the subform is based on and call it something like  qTRNX_TYPE_I
Put "I" in the criteria of the TRNX_TYPE field
Put Is Not Null in the criteria of the DATE_RECD field

Then put a command button in the header of the subform that does this in the OnClick Event
Me.RecordSource = "qTRNX_TYPE_I"
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

820 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