Group:  Microsoft Access ยป microsoft.public.access.forms
Thread: sub-form problem- i'll try again for help

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

sub-form problem- i'll try again for help
"Kurt Neumann" <kurtneumann[ at ]mindspring.com> 22.09.2006 13:29:22
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



Re: sub-form problem- i'll try again for help
"Rick Brandt" <rickbrandt2[ at ]hotmail.com> 22.09.2006 13:41:05
Kurt Neumann wrote:
[Quoted Text]
> 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

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



Re: sub-form problem- i'll try again for help
"Kurt Neumann" <kurtneumann[ at ]mindspring.com> 22.09.2006 15:37:03
perfect, thanks!
"Rick Brandt" <rickbrandt2[ at ]hotmail.com> wrote in message
news:RJRQg.3427$GR.2757[ at ]newssvr29.news.prodigy.net...
[Quoted Text]
> Kurt Neumann wrote:
>> 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
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com
>
>
>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net