473,396 Members | 2,055 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,396 software developers and data experts.

How do I update the calculated textbox based on listboxes in an unbound form?

The issue is that the calculated text box does not actually requery until each of the associated listboxes have been clicked into and exited.

I have an unbound form that looks up various pieces of a product number entered in an unbound text box (ProductNumber) and returns weights and lengths in unbound listboxes that are based on queries.
The criteria for the queries are based on functions that return a specific string from the product number.
Then there is a calculated textbox control (txtCombinedLenmm AND txtCombinedWeights) based on the list box controls (which is also the listbox's underlying query's value). The calculation only uses the control if there is a result in that listbox control.

On the On_Exit of the product number control:
all associated controls are being requeried, the calculated textbox's control source is determined and then the calculated control is requeried:
Expand|Select|Wrap|Line Numbers
  1.     Me.txtCombinedLenmm.ControlSource = "=IIf(nz([lstRingSizeGroundmm],0)=0 And nz([lstRingSizemm],0)=0,Round(CDbl(nz([lstSusLenmm],0))+CDbl(nz([lstLPlenmm],0))+146.05,2),CDbl(Round(nz([lstSusLenmm],0)+nz([lstLPlenmm],0)+nz([lstRingSizemm],0)+nz([lstRingSizeGroundmm],0)+146.05,2)))" 
  2.  
  3.    Me.txtCombinedWeights.ControlSource = "=Round(nz([lstSusWgtKg],0)+nz([lstLPwgtKg],0)+nz([txtKgRingWgtGrnd],0)+nz([txtKgRingWgt],0),2)"
  4.  
Then
Expand|Select|Wrap|Line Numbers
  1.     Me.txtCombinedLenmm.Requery
  2.     Me.txtCombinedWeights.Requery
  3.  
Is there a way to have the text box recalculate the entire formula with all involved controls without having to get focus and exit each of the controls in the calculation? Neither RECALC, REFRESH, nor REQUERY for the form or controls is working.

Thank you in advance for any help - nothing logical seems to be working.
with ruth
Dec 14 '10 #1
2 2459
ADezii
8,834 Expert 8TB
ruth, try using the Recalc Method which will immediately update all Calculated Controls on a Form. The Syntax is simple, but you must place the Code in an appropriate Context, as in:
Expand|Select|Wrap|Line Numbers
  1. Sub SomeControl_AfterUpdate()
  2.   Me.Recalc
  3. End Sub
Dec 14 '10 #2
Thank you ADezii. Being an unbound form the AfterUpdate doesn't function. I did try recalc in the control_exit sub and it still does not update/recalc the calculated text box control without clicking into and out of the listbox controls used in the calculation. Any other ideas are appreciated.
Dec 16 '10 #3

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

Similar topics

2
by: isaphrael | last post by:
I have an unbound form with a textbox with an input mask 00\-00000;;_ Putting some data into the text box and then trying to close it throws the 'didnt match input mask' warning, and if I click ok...
1
by: Chris Belcher | last post by:
I have a unbound form with 2 subforms. It looks something like this _______________________________________________ | | | | | ...
4
by: Pierre | last post by:
Hi all, To ease load on a network i close automatically form open with a timer reset by user actions. If the time is expired i go through the collections of form and table and close all those...
11
by: TD | last post by:
I'm looking for input into my decision to switch to ADO and unbound forms. I get tired of having to block all of the ways a user can unknowingly save a record, like using the PageUp, PageDown keys...
1
by: MARCOC | last post by:
What is the easiest way to check if any data has been changed by the user on my unbound form. I have 12 text boxes and 2 combo boxes on the unbound form. Thanks,
6
by: Dave G | last post by:
I am writing a function to fill in the data in an unbound form. I have a table with field names of 1, 2, 3 etc up to approx 100. I have an unbound form with fields called 1, 2 3 etc. I gave...
6
by: Volker Neurath | last post by:
Hi all, I have a Problem with combobox-property "NotInList" and an unbound Form. The situation: On my main form i have three comboboxes for data-exchange (here: Names of distributor,...
7
by: DeZZar | last post by:
Hi all, Unfortunately I am quite a novice with Access!! I've created a number of data bases for my work however becuase my skills are limited to really built in functionality and wizards my...
7
by: troy_lee | last post by:
I have an unbound form. I have an Add New procedure that saves a new record to the database. What is the best way to update an existing record? In other words, clicking my "Submit record" button...
11
by: MadSma | last post by:
hi iam quite new to access and i am now at a stage where i have created my database tables and various forms to input data on them but i need a way of displaying data based on some search criteria ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.