Referencing a Subform on a tab control from the close event of a popup form in Access 97

Hi there,

I'd really appreciate it if anyone could help me get the right syntax for referencing a subform on a tab control from the close event of a popup form in Access 97. The object hirearchy is as follows:

frm_Customer_Detail  -> tabctrlmain.item.pages(3) -> frm_sub_Support_LogDetail.

I'm trying to reference this subform to call it's refresh method.

This is doing my head in and very urgent now, so I'm offering as many points as possible for a solution.


Who is Participating?
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.

did you try this?

If your code to refresh the subform is in the parent form of the subform, you can simply give 'me.frm_sub_Support_LogDetail.Requery'

Note: If you want the form to reflect the latest data from the binding table you need to 'Requery' not 'Refresh'.
jay1971aAuthor Commented:
Hi there, I've tried several permutations of forms / control references and can't seem to find the right combination. I'm pretty sure that you need to make reference to the tab control on the main form, though.


It isn't necessary at all. I am using in my form to display the history of transactions in a subform within  the tabcontrol.
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

jay1971aAuthor Commented:
Well, if I use the syntax you suggested in the previous post, I get the following error:

"Application defined or object defined error"

I've also tried referencing this subform using multiple variations on the standard syntax for referencing subforms etc.

Any other suggestions?


These commands I have used in my applications and there are more than 20 users using this application 5 days a week, every minute.

That's why I'm so confident. But I don't know any other means.

And the error msg that you have specified I used to get with linked tables. connection issue. Please check the data source and related properties.

Meanwhile, I'll seeif something comes across.
jay1971aAuthor Commented:
My client is an Access 97 client linked via odbc to a sql server 2000 database.

The subform in question gets it's data from a view. The links are all fine and there's no problem with the displayed data. I just want to refresh / requery this form to display the additions / edits made using the pop-up form in it's close event so that the changes are immediately apparent.

If you can suggest another way of doing this without getting bogged-down in the complex syntax of referecing subforms on controls etc. it would be great.

Thanks for your help,

My suggestions:
1.Make sure your connection to the SQL server is not lost when you close the popup form. ie if you use the same sql connection in the pop up window and in the subform.

2. Make sure that you commit the transaction( rst.update) and close the record set (rst.close) so any incomplete db write process is completed, when you close the pop up form. Give the requery command after this event. I mean to say that after closing the recordset put the control into parent form ie Forms!parentform.anyeditablecontrol.setfocus.

 thanx for your patience. I'm trying to help you..
jay1971aAuthor Commented:
Thanks for those suggestions.

The subform is bound to the view I mentioned before but all of the other operations - Insert, Update - are being manged by the popup form which pulls in the data using a stored procedure on the load event using ADO and also calls Insert and Update stored procedures with ADO via on_click events.

I can get around my issue temporarily by creating a refresh button on the subform or placing the 'me.requery' statement on the dbl_click event for the detail of the subform but I really want this requery to happen when the popup form is closed.

If you or anyone else can help me with this it would be greatly appreciated?

Thanks again.

jay1971aAuthor Commented:
OK, I think we'll have to put this one down to over-complication.

It turns out that simply referencing the top level form and then calling the refresh or requery method did the job I wanted.

i.e.  Forms("frm_Customer_Detail").Requery

Any attempt to go down another level to the subform contained on a tab control which is in turn contained within the main form fails in the ways listed in the thread above.

I'm not sure whether this is an Access 97 quirk or whether it's a known issue with Access but I think it's definitely something users need to be aware of.

If anyone can clarify this further or shed any further light on the matter, I'd be interested to hear but, to all intents and purposes, I htink we can consider this question closed.

Thanks for your help with this Kaaviyam.


thanks and best of luck
PAQed with points refunded (500)

EE Admin

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
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

From novice to tech pro — start learning today.