sub-form problem- i'll try again for help

K

Kurt Neumann

i have a form with a subform attached. actually the subform does not share
data with the same form, but is an independent table. The table on which
the subform is based is edited and records are added from another dabase
with a
linkded table. I would like to have the subform requeried every time the
underlying table is added to. Is there anyway to do this? An alternative
would be to requery the subform via an action on the main form. But if I
issue a "forms![subfrm].Requery" statement, from the main form I get an
error that the subform is not recognized as being opened.
Is there an easy solution?
THanks
 
R

Rick Brandt

Kurt said:
i have a form with a subform attached. actually the subform does not
share data with the same form, but is an independent table.

That is how it should be in almost all cases.
The table
on which the subform is based is edited and records are added from
another dabase with a linkded table. I would like to have the subform
requeried every time
the underlying table is added to. Is there anyway to do this?

There is no way for this to happen directly, but if ALL edits to the table
leave some evidence that your database with the subform is in can "see" then
the subform can have Timer code that tests for that evidence every so often.
For example; if every row in the table had a LastModified Date/Time field
then your subform could retrieve the maximum value of that field every few
seconds and compare it to the last one that it retrieved. Any time the
values are different then issue a Requery.

Of course depending on the number of records and how "expensive" it is to do
a Requery, you could just simply issue a Requery every time the Timer event
fires and be done with it.
An
alternative would be to requery the subform via an action on the main
form. But if I issue a "forms![subfrm].Requery" statement, from
the main form I get an error that the subform is not recognized as
being opened. Is there an easy solution?

A form displayed in a subform is not technically "opened". Just use...

Me!SubformControlName.Form.Requery

....or you could just have the subform issue the Requery on itself...

Me.Requery
 
K

Kurt Neumann

perfect, thanks!
Rick Brandt said:
Kurt said:
i have a form with a subform attached. actually the subform does not
share data with the same form, but is an independent table.

That is how it should be in almost all cases.
The table
on which the subform is based is edited and records are added from
another dabase with a linkded table. I would like to have the subform
requeried every time
the underlying table is added to. Is there anyway to do this?

There is no way for this to happen directly, but if ALL edits to the table
leave some evidence that your database with the subform is in can "see"
then the subform can have Timer code that tests for that evidence every so
often. For example; if every row in the table had a LastModified Date/Time
field then your subform could retrieve the maximum value of that field
every few seconds and compare it to the last one that it retrieved. Any
time the values are different then issue a Requery.

Of course depending on the number of records and how "expensive" it is to
do a Requery, you could just simply issue a Requery every time the Timer
event fires and be done with it.
An
alternative would be to requery the subform via an action on the main
form. But if I issue a "forms![subfrm].Requery" statement, from
the main form I get an error that the subform is not recognized as
being opened. Is there an easy solution?

A form displayed in a subform is not technically "opened". Just use...

Me!SubformControlName.Form.Requery

...or you could just have the subform issue the Requery on itself...

Me.Requery
 

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