Clear Subform on Load

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.
MeginAsked:
Who is Participating?
 
MeginConnect With a Mentor Author Commented:
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
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
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
 
Dale FyeCommented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
MeginAuthor Commented:
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
 
MeginAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.