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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now