Solved

Clear Subform on Load

Posted on 2014-04-17
6
763 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
6 Comments
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
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 84
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:Megin
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

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

15 Experts available now in Live!

Get 1:1 Help Now