?
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
Medium Priority
?
672 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

764 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