[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

When a calculated field changes on a form, I want the value of another control to change as well. How do I do that?

Posted on 2011-03-24
4
Medium Priority
?
174 Views
Last Modified: 2012-05-11
I need a field on a form to change to the same value when a certain calculated field changes value.
I need to store this value to act as a flag in another form.
Help please.
0
Comment
Question by:Fritz Paul
[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
  • 2
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 35205933
I assume you are talking about an calculated control on a form, not one of the new calculated field types in A2010.

You need to go back a step to do this.

If you have a calculated control, that control must be based on other fields and/or controls on the form or in the form's recordcource.  You need to add a line of code to the afterupdate event procedure of each of any editable 'source' controls.

The code would look like..

me.targetcontrolname = me.calculatedfieldname
0
 

Author Comment

by:Fritz Paul
ID: 35206311
Hi,
No this is not 2010.
Yes that is a solution, which I used on another form.
Took me ages to program each control. I was wondering if there wer not a solution like for the forms OnChange that if anything changes the value of the calculated field would update the bound field.
What I do now is that I added a close button and at least when I click the close button I set the bound control to the value of the calculated control.
Thanks for the help.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 1000 total points
ID: 35208917
In general, Form events do not fire unless there is no available Control event which can fire first.

"What I do now is that I added a close button and at least when I click the close button I set the bound control to the value of the calculated control."

That seems very sensible as long as you don't need to see the changes as soon as they are made (which seems unlikely in this case- it sounds like you don't really need the bound field on the form at all). The more common route in VBA would be to use the Form_Beforeupdate event procedure to set the bound field value just as the record is being saved.
0
 

Author Comment

by:Fritz Paul
ID: 35209029
Thanks for the Beforeupdate event tip.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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 …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

650 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