Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Clear Subform on Load

Posted on 2014-04-17
6
Medium Priority
?
1,140 Views
Last Modified: 2014-04-26
I have a subform in Access that I would like to have clear when the main form is opened.

The subform is based on a query that uses options chosen in the main form.

Right now the subform contains every record when it opens, rather than waiting on the items to be chosen in the main form.
0
Comment
Question by:Megin
[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
6 Comments
 
LVL 58
ID: 40007650
You can set it DataEntry property to true by default, clear it's recordsource and set it later, give it a default filter of 1=0 (which is never true and returns no records), or use a control (hidden) as the master value, which you clear and set on your own.

Jim.
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 40007653
I generally just delete the subform controls SourceObject property, and hide the subform during form load.

Then, after the form is loaded, I will set the SourceObject and make it visible.  You could do the same thing with your main form.
0
 
LVL 85
ID: 40008752
To add to what the others have written:

If your subform object is bound (i.e. has a Recordsource), then Access will always try to fill it with data. In the case of subforms, it will try to fill it with data related to the current record in the main form (assuming you've set the Master and Child properties, of course).

The only way to not show that data is to "fool" Access into either thinking it has no recordsource, or that it's not linked to anything - hence the reasoning behind the suggestions above.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Megin
ID: 40008912
Thank you, everyone. I will be trying these out later today.
I just didn't want you all to think I was ignoring you.
0
 

Accepted Solution

by:
Megin earned 0 total points
ID: 40013678
I am sorry to take so long to get back to everyone.

None of the solutions really worked for me, but I adjusted the query that filled the sub form and that ended up working.

Thank you for your time and suggestions!
0
 

Author Closing Comment

by:Megin
ID: 40024355
I changed the query in the background to match up with more fields in the main form. This ended up doing what I needed it to do.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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 …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

719 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