requery a subform

  • Thread starter Thread starter placek
  • Start date Start date
P

placek

Hello

My main form is called Form1 and the subform within it is
called fsubForm1. How do i reference the subform from an
event handler for a command button contained in Form1?

Thanks in advance
Martin
 
If all you need to do is requery the subform, then this is no problem.

Note that the subform's Access Name may be different than what the form has called it. Click the edge of the subform while in design view and check the "name" field in the properties window. For example, the subform might be called subfrmStuff in the Access window... while the form may refer to it as MySubForm. While in the VBA code of the button's click event, just type the equivalent of "MySubForm.Requery".

Jeff Johnson
Advantec Information Systems
http://www.advantecis.com

----- placek wrote: -----

Hello

My main form is called Form1 and the subform within it is
called fsubForm1. How do i reference the subform from an
event handler for a command button contained in Form1?

Thanks in advance
Martin
 
Hi Jeff

I tried your suggestion but it does not work. You see
fsubBooks is based on qryBooks, and for some reason
qryBooks updates when the command button is clicked.
Unfortunately, fsubBooks does not update straight away. It
is only when i go into design view and then back into form
view that it updates. Any ideas as to what is wrong? There
seems to be a problem with the connection between qryBooks
and fsubBooks but i don't know what.

Martin

-----Original Message-----
If all you need to do is requery the subform, then this is no problem.

Note that the subform's Access Name may be different than
what the form has called it. Click the edge of the
subform while in design view and check the "name" field in
the properties window. For example, the subform might be
called subfrmStuff in the Access window... while the form
may refer to it as MySubForm. While in the VBA code of
the button's click event, just type the equivalent
of "MySubForm.Requery".
 
ok, thanks Jeff. I'll give that a try.
-----Original Message-----
Hmmm....

I can't guess what's wrong based on what you say.

I suggest that you make as simple of an example as you
can of the subform requery. If you can make it work in a
simple example, you may discover the problem in your
current form. If not, you might extend your example to do
what the 'real' form was supposed to do.
I don't see how the query itself can mess up the process--
if you're talking to the subform programmatically the sql
should requery reqardless. You are on the right track if
you the intellisense window pops up in vba when you type
the form's name for the the sub-form.
 
Back
Top