Link to home
Start Free TrialLog in
Avatar of jay1971a
jay1971a

asked on

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.

Cheers,

Jay.
Avatar of kaaviyam
kaaviyam

did you try this?
Forms!frm_Customer_Detail.frm_sub_Support_LogDetail.Requery

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'.
Avatar of jay1971a

ASKER

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.

Cheers,

Jay.
It isn't necessary at all. I am using in my form to display the history of transactions in a subform within  the tabcontrol.
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?

Cheers,

Jay.
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.
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,

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

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

Cheers,

Jay.
thanks and best of luck
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial