Solved

Calculated field value will not appear until I click another field

Posted on 2013-06-25
7
526 Views
Last Modified: 2013-06-26
I have a field on a form which is a calculated field.  The name of the field is "txtDraw1Interest"  The calculation is:

=([txtDraw1Amount]*[txtDraw1DaysOut])*[txtIntRateLoan]/100

But the calculated value isn't showing up in the field until I click on another field anywhere on the form.

I've tried an after update event on the last field data is entered into, "txtDraw1Date".  The code I tried is:

    Me.txtDraw1Interest.Requery

But it doesn't work.  I also tried it in a beforeupdate event.

????
0
Comment
Question by:SteveL13
  • 3
  • 2
  • 2
7 Comments
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39275032
If you are typing in the control (txtDraw1Date), then you are not changing the value, you are changing the text property of that control.  The "Value" of that control will not actually change until you leave that control via (Enter, Tab, or some click event outside of that control).
0
 

Author Comment

by:SteveL13
ID: 39275093
I am tabbing off the date field and Me.txtDraw1Interest is not updating until I click on another field.  So I wonder why tabbing off the date field isn't working?
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39275145
On closer look, I see that the code in your control source does not reference txtDraw1Date, so what do you expect to happen?

Is one of the controls referenced in your statement:

=([txtDraw1Amount]*[txtDraw1DaysOut])*[txtIntRateLoan]/100

influenced by the data in txtDraw1Date?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 49

Expert Comment

by:Gustav Brock
ID: 39275146
You could try with:

  Me.Dirty = False

to save the entry.

/gustav
0
 

Author Comment

by:SteveL13
ID: 39275212
The formula:

=([txtDraw1Amount]*[txtDraw1DaysOut])*[txtIntRateLoan]/100

Is the control source for

txtDraw1Interest

The event I have it in right now is in the afterupdate event of:

txtDraw1Date
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39275244
But none of those fields have anything to do with txtDraw1Date?

Why would you expect the value to txtDraw1Interest to change if you make a change in txtDraw1Date?  That field (txtDraw1Interest) is only going to change if you change the value of one of the following controls:

txtDraw1Amount
txtDraw1DaysOut
txtIntRateLoan
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 39275307
The AfterUpdate event of txtDraw1Date will never fire.

AfterUpdate is related to user input, Thus - if at all needed - you should recalc/requery at the AfterUpdate event of the other textboxes.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

920 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

13 Experts available now in Live!

Get 1:1 Help Now