473,409 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Refresh a control on a form that performs a calculation

kcdoell
230 100+
Hello:

I thought I was done with this one but a user who is testing my DB just pointed out a problem.

I used the following in the afterupdate event:


Expand|Select|Wrap|Line Numbers
  1. Private Sub Binding_Percentage_AfterUpdate()
  2. 'Updates the Total calculation in the control "SumGWP", Sum50GWP, "SUMNWP" and Sum50NWP
  3. 'on the quick reference table on the Forecast form.  
  4.  
  5. Me.Refresh
  6.  
  7. End Sub 

Basically, once I change the Binding_Percentage and tab into another field on the same row my numbers (My unbound controls that are performing a calculation) change appropriately but the minute I click on to another row (using the mouse or tab) on my table the numbers change. It looks like the numbers change to the old settings. When I click back to the row I changed, the numbers go back to what they are supposed to reflect. I changed the code to the following:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Binding_Percentage_AfterUpdate()
  2. 'Updates the Total calculation in the control "SumGWP", Sum50GWP, "SUMNWP" and Sum50NWP
  3. 'on the quick reference table on the Forecast form.  
  4.  
  5.  Me.Dirty = False
  6.     Me![SumGWP].Requery
  7.     Me![Sum50GWP].Requery
  8.     Me![SumNWP].Requery
  9.     Me![Sum50NWP].Requery
  10.  
  11.    End Sub
But the same strange thing happens......

I read that if a Control is unbound, the many instances of this Control on the Continuous Form will display the same value in all instances. Therefore I would need to somehow bind the Control on the Continuous Form if I need to display different values in its instances.

Does that make sense to anybody out there, so far I am not getting it..

Any ideas would be great,

Keith.
May 20 '08 #1
5 17361
RuralGuy
375 Expert 256MB
Does it help if I say that in order for a control on a continuous form to display a unique value it needs to be bound to a field in the underlying RecordSource?
May 20 '08 #2
kcdoell
230 100+
Does it help if I say that in order for a control on a continuous form to display a unique value it needs to be bound to a field in the underlying RecordSource?
Not really, In the case of my [SumGWP] I have the control source set to
Expand|Select|Wrap|Line Numbers
  1. =Nz(DSum("[GWP]","ReQryForecast","[Binding_Percentage] >= 75"),0)
[GWP] & [Binding_Percentage] are controls on my form and the control source of the form is set to a query (ReQryForecast). Did I not bind [SumGWP]??????

If you can help me understand better or maybe it is bound already after my explination....
May 20 '08 #3
RuralGuy
375 Expert 256MB
Putting a formula or function such as you have in the ControlSource of a control is not binding the control. Binding the control would be setting the ControlSource of the control to point to a field in the RecordSource of the form.
May 20 '08 #4
kcdoell
230 100+
Hello:

Okay, problem solved! I tell you what I did but don’t totally understand it. I set my AfterUpdate to the following:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Binding_Percentage_AfterUpdate()
  2. 'Updates the Total calculation in the control "SumGWP", Sum50GWP, "SUMNWP" and Sum50NWP
  3. 'on the quick reference table on the Forecast form.  
  4.  
  5.  Me.Dirty = False
  6.     Me![SumGWP].Requery
  7.     Me![Sum50GWP].Requery
  8.     Me![SumNWP].Requery
  9.     Me![Sum50NWP].Requery
  10.  
  11.    End Sub
Then in the unbound controls themselves I was looking at my control source formula. In the case of my [SumGWP] I had the control source set to:
Expand|Select|Wrap|Line Numbers
  1. =Nz(DSum("[GWP]","ReQryForecast","[Binding_Percentage] >= 75"),0)
and did not see why I needed to refer to the control source of my form [ReQryForecast] to sum my [GWP]. So I took it out of the expression:

Expand|Select|Wrap|Line Numbers
  1. =Sum(IIf([Binding_Percentage]>=75,[GWP],0))
And bang the problem went away……………………….. Too bad I spent a ton of time building queries to perform the calculation with the Continuous form idea I was running with when the solution was easier than that…..
Thanks for the help.

Keith.
May 20 '08 #5
RuralGuy
375 Expert 256MB
Excellent! Glad you got it sorted.
May 20 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: cdelaney | last post by:
I have a form that I created a calculation on using 2003. The calculation works exactly like I want it to but ONLY on the first and last record. The calculation does not work/exist on records in...
2
by: Peter Oliphant | last post by:
I now have graphics being drawn in the Paint event of my form (yeah, and it's very cool). Problem was that it only updated any changes to these graphics when Paint was called. So, I then made it...
3
by: Li Pang | last post by:
Hi, I used a form tp populate data. When the data is still processing, I leave the form and go to some external application, and then back the my application again, the form becomes blank. The...
2
by: david.boone | last post by:
Hello, I am trying to enable controls based on the value of a checkbox, i.e. if value = true then enable. I have a tab control form with controls on 4 tabs. I have some code (below) on the...
0
by: Filippo Bettinaglio | last post by:
hi, I have developed a window control form in C sharp 2005, I can use the component in other .exe applications (just keeping the two project in the same solution group file) but I cannot use it...
3
by: Piter | last post by:
Hi I have a form with source of data on query "qrymultiselect" On this form I have a multiselect list and a button "filter" With click a button there is a procedure that is creating query...
2
by: TerryStone | last post by:
I have created a control that displays a list of items. During design mode I fill it with junk data using calls from the constructor. So when I look at a form with the control on, instead of...
6
by: antheana | last post by:
Hi there, I have a job details form - on that form I have fields to store the job rate, expenses and number of days this rate/expenses applies e.g. rate £150, expenses £24 for 3 days. I have 2...
0
by: GeoffT | last post by:
I have encountered a problem with the data that is displayed in the list boxes that are located on a tab control access form (2003 version). This form uses several combo boxes as filters (After...
2
by: phill86 | last post by:
Hi I have a calendar control (MS office Access calendar control 11.0) on my form and i want to refresh the form as soon as i have selected the date on the calendar any ideas? Cheers Phill
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.