How do I requery a sub form on the main form

J

Jagmel Bharj

I have a main form containing a sub form created from a query. On entering
data in the main form I would like to get an updated value in the sub form.
Eg on the main form enter quantity 5.on exit of this field the sub form
should display the new quantity with 5 taken away
I could only get the resut by pressing a button created through the wizard
to requery. I want an automatic solution
Thanks
Jack
 
G

Gary Walter

Hi Jagmel,

Here is the general statement to requery
a subform:

Forms!MainFormName.SubformControlName.Form.Requery

Ex:

Main form name = "frmMain"
subform name = "frmSub"
**********
name of control (container) on frmMain
that uses frmSub as a SourceObject = "subfrmSub"
**********

So if you looked at Properties of the subform
control on your frmMain that contains frmSub:

Name....................subfrmSub
Source Object.......frmSub


To requery your subform:

Forms!frmMain.subfrmSub.Form.Requery

It sounds like you want to put the above
line in the AfterUpdate event of the textbox
that you are entering your quantity
(replacing "frmMain" with name of your
main form....and replacing "subfrmSub"
with the name of your subform control).

Please respond back if I have misunderstood.

Good luck,

Gary Walter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top