Solved

How make subform display only certain records

Posted on 2014-11-28
2
772 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:
SimonAdept 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

757 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

20 Experts available now in Live!

Get 1:1 Help Now