Subform requery vs. refresh

Dear experts,
I have a subform that I am trying to requery in the current event of another subform (at the same 'level') on the same form.

The requery works fine, however there is a calculated field on the other subform which is not updating. So I added a 'refresh' command, which seems to work, however NOT the first time the event fires.

The error I get is:
Error 2455: you entered an expression that has an invalid reference to the property Form/Report.

Code is below. I confirmed that it is the REFRESH line that invokes the error.

Any ideas?

If Me.Parent.sf1.SourceObject = "Vendor_QuickView" Then
End If

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
when you say the first time, do you mean when the form loads?

perhaps before the refresh, add:
On Error Resume Next

Open in new window

terpsichoreAuthor Commented:
I think that will work, just want to: a) understand why this happens; and b) see if that is the best workaround. thanks -
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
when the form loads, the second subform probably isn't loaded yet when the first one runs the current event
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

terpsichoreAuthor Commented:
ok, but I'm wondering why the requery line immediately above it does not generate an error?
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
Refresh gets all changes from other processes and users, in addition to showing changes to calculations  -- perhaps it just cannot do that yet.  I believe it also saves the record. Requery forces the form to reload.

I suspect the only time the error happens on refresh is when the form is first loaded ... this is common.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
terpsichoreAuthor Commented:
ok - we will leave it at that - thank you!
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
I'm big on Access letting it do it's own thing rather than trying to control things, So a trick to synching multiple subforms:

1. Place a hidden control on the main form.
2. Use this hidden control as part of the master link on the second subform control.
3. In the  OnCurrent event of the first subform, set the hidden control on the parent.

 This let's it all be automatic.   Main form changes, first subform changes, hidden control gets set, and second subform changes.

terpsichoreAuthor Commented:
Great thinking.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
nice tip, Jim ~ I do that as well.  Nothing was mentioned about how the forms were synchronized -- perhaps I should have asked.

thank you and you're welcome, terpsichore
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.