Stop Subform Populating on form load

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi there,

I've got a form that contains a number of combo boxes that are used as
filters (criteria) for running a query, which appears as a subform in the
same form.

I've got a command button that requery's the subform, but is there a way
that I can prevent the subform being populated when the original form is
opened? (I'd rather it waited until I've selected the options from the
combos and then clicked the requery button?

Many thanks

John
 
John said:
Hi there,

I've got a form that contains a number of combo boxes that are used as filters
(criteria) for running a query, which appears as a subform in the same form.

I've got a command button that requery's the subform, but is there a way that
I can prevent the subform being populated when the original form is opened?
(I'd rather it waited until I've selected the options from the combos and then
clicked the requery button?

Leave the SourceObject property of the subform control blank and apply it
instead of using Requery.
 
Hi Rick,

Thanks for this. I had a go with your suggestion, but I assume I'm not
doing it in the right way:

Me.sbfrmvNew.SourceObject = "SELECT......

Unfortunately it doesn't want to let me change the property?
 
Hi Arvin,

Thanks for this and the link. I'm afraid I don't quite understand what this
does? Is it just a blank query to give it something to think about?

John
 
It keeps each of the bound controls on the form from reading "#Name"

If you are building the RecordSource with each combobox choice, you must
start with an unbound subform, or one which is empty. This query allows you
to bind to a recordsource which will never have any records, until you make
your choices in the combobox.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
John said:
Hi Rick,

Thanks for this. I had a go with your suggestion, but I assume I'm
not doing it in the right way:

Me.sbfrmvNew.SourceObject = "SELECT......

Unfortunately it doesn't want to let me change the property?

The SourceObject is the name of the form being displayed with the subform
control.
 
Back
Top