Solved

Refresh parent form text box that is bound to table when child event runs in Access 2003 vba

Posted on 2014-10-09
3
642 Views
Last Modified: 2014-10-09
Hi all.

I have an Access 2003 ADP file that has a form (ParentA). This form has 3 tabs, one of which is the "Costs" tab. On this tab there is a child form (ChildA). I have an event that runs in this child form every time a certain field is updated, the event updates the "freight" field in TableA. The datasource for ParentA is the TableA table.

There is a field called txtFreight that is bound to this "freight" field in TableA and it is in the ParentA form. So, you have the "Costs" tab, in the detail section you have the child form ChildA and right under the child form you have the txtFreight text box.

The problem I'm having is every time the child form event runs and updates the Freight field in TableA, it does not update the txtFreight field in the tab. I have to close the entire form, then open again and when I go back to the "Costs" tab then I see the updated freight in the txtFreight text box.

Any idea how I can have refresh the txtFreight right from the child form event?

Thank you in advance.
0
Comment
Question by:Sim1980
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
Bitsqueezer earned 500 total points
ID: 40370554
Hi,

as the you only update and not delete or insert values the parent form has the linked record displayed so you can update that in the child form's event with "Me.Parent.Refresh" which only refreshes updated values and do not change the record pointer.

Cheers,

Christian
0
 

Author Comment

by:Sim1980
ID: 40370662
Thank you for your reply.

I added "Me.Parent.Refresh" and now I get the following error:
Run-time error '2455': You entered an expression that has an invalid reference to the property Form/Report.

When I click the debug button it points to the following line of code:
"Me.ChildFormB!DeleteRecord.Enabled = toEnable"
0
 
LVL 24

Expert Comment

by:Bitsqueezer
ID: 40371005
Hi,

that is a wrong reference, if "ChildFormB" is the name of the subform container control then you need to add ".Form" to access anything on the form.

So this must be:
Me.ChildFormB.Form.DeleteRecord.Enabled = toEnable

Open in new window


That is another issue with your main form and has nothing to do with the Refresh method, you should have got this error even without that.

Cheers,

Christian
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question