A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Text box value based on sum of another text box



 
 
Thread Tools Display Modes
  #1  
Old December 29th, 2006, 05:14 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 2
Default Text box value based on sum of another text box

Hi guys,

I am doing a Access project to manage the engineering department
jobs. In a form binded to a table, I am trying to show in a text box
the result of an equation based on the sum of the "value" variable. I
want that equation to update "on change" of the "value" text box. How
would the equation be formulated? Here is what I tried:

--- 1st try ---
Private Sub CommValeur_AfterUpdate()

CommDelaisEntree = DSum("[CommValeur]", "T: CommandeIngenierie",
"[CommandeCompletee] = 'No' AND [CommandeAnnulee] = 'No'") * 0.07 / 42
/ 37.5 / 3.25

End Sub
---------------

I get a runtime '2001' error.

CommValeur : Value variable to be summed
CommDelaisEntree : Variable to be calculated from sum of Value variable
T: CommandeIngenierie : Binded table
CommandeCompletee : states if order is completed, I need to sum only
none completed orders
CommandeAnnulee : states if order was cancelled, I need to sum only
live orders

Any clues?

Thanks guys.

Dominic.

  #2  
Old December 29th, 2006, 06:00 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Text box value based on sum of another text box

Error 2001 can be misleading. It is often caused by a field or table name in
a Domain Aggragate function being named incorrectly; that is, misspelling the
name. What happens is Access creates an SQL statement it passes to Jet. Jet
can't find the references and does not execute the query and passes an error
back to Access which Access interprets as a canceled operation.

I suspect this part of the statement:
"T: CommandeIngenierie"

That is not a valid table name.


" wrote:

Hi guys,

I am doing a Access project to manage the engineering department
jobs. In a form binded to a table, I am trying to show in a text box
the result of an equation based on the sum of the "value" variable. I
want that equation to update "on change" of the "value" text box. How
would the equation be formulated? Here is what I tried:

--- 1st try ---
Private Sub CommValeur_AfterUpdate()

CommDelaisEntree = DSum("[CommValeur]", "T: CommandeIngenierie",
"[CommandeCompletee] = 'No' AND [CommandeAnnulee] = 'No'") * 0.07 / 42
/ 37.5 / 3.25

End Sub
---------------

I get a runtime '2001' error.

CommValeur : Value variable to be summed
CommDelaisEntree : Variable to be calculated from sum of Value variable
T: CommandeIngenierie : Binded table
CommandeCompletee : states if order is completed, I need to sum only
none completed orders
CommandeAnnulee : states if order was cancelled, I need to sum only
live orders

Any clues?

Thanks guys.

Dominic.


  #3  
Old December 29th, 2006, 06:32 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 2
Default Text box value based on sum of another text box


Klatuu wrote:
Error 2001 can be misleading. It is often caused by a field or table name in
a Domain Aggragate function being named incorrectly; that is, misspelling the
name. What happens is Access creates an SQL statement it passes to Jet. Jet
can't find the references and does not execute the query and passes an error
back to Access which Access interprets as a canceled operation.

I suspect this part of the statement:
"T: CommandeIngenierie"

That is not a valid table name.


" wrote:

Hi guys,

I am doing a Access project to manage the engineering department
jobs. In a form binded to a table, I am trying to show in a text box
the result of an equation based on the sum of the "value" variable. I
want that equation to update "on change" of the "value" text box. How
would the equation be formulated? Here is what I tried:

--- 1st try ---
Private Sub CommValeur_AfterUpdate()

CommDelaisEntree = DSum("[CommValeur]", "T: CommandeIngenierie",
"[CommandeCompletee] = 'No' AND [CommandeAnnulee] = 'No'") * 0.07 / 42
/ 37.5 / 3.25

End Sub
---------------

I get a runtime '2001' error.

CommValeur : Value variable to be summed
CommDelaisEntree : Variable to be calculated from sum of Value variable
T: CommandeIngenierie : Binded table
CommandeCompletee : states if order is completed, I need to sum only
none completed orders
CommandeAnnulee : states if order was cancelled, I need to sum only
live orders

Any clues?

Thanks guys.

Dominic.


I tried to change the table names to remove que ":" and the space.
Here is the last version of the equation, which returns a 3464 runtime.

CommDelaisEntree.Value = DSum("[CommValeur]", "CommandeIngenierie",
"[CommCompletee] = 'No' And [CommAnnulee] = 'No'") * 0.07 / 42 / 37.5 /
3.25

More clues?

  #4  
Old December 29th, 2006, 06:47 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Text box value based on sum of another text box

That error is a data type mismatch. It means the result of your calculation
is not compatible with the data type of the field being used.

CommDelaisEntree.Value should be a text box control on your form. Memory
variables do not have a value property. In fact, you don't need to use the
..Value property, it is the default property of a text box.
The field [CommValeur] needs to be either a Single or Double data type.
Integers and Longs do not accept decimals.

" wrote:


Klatuu wrote:
Error 2001 can be misleading. It is often caused by a field or table name in
a Domain Aggragate function being named incorrectly; that is, misspelling the
name. What happens is Access creates an SQL statement it passes to Jet. Jet
can't find the references and does not execute the query and passes an error
back to Access which Access interprets as a canceled operation.

I suspect this part of the statement:
"T: CommandeIngenierie"

That is not a valid table name.


" wrote:

Hi guys,

I am doing a Access project to manage the engineering department
jobs. In a form binded to a table, I am trying to show in a text box
the result of an equation based on the sum of the "value" variable. I
want that equation to update "on change" of the "value" text box. How
would the equation be formulated? Here is what I tried:

--- 1st try ---
Private Sub CommValeur_AfterUpdate()

CommDelaisEntree = DSum("[CommValeur]", "T: CommandeIngenierie",
"[CommandeCompletee] = 'No' AND [CommandeAnnulee] = 'No'") * 0.07 / 42
/ 37.5 / 3.25

End Sub
---------------

I get a runtime '2001' error.

CommValeur : Value variable to be summed
CommDelaisEntree : Variable to be calculated from sum of Value variable
T: CommandeIngenierie : Binded table
CommandeCompletee : states if order is completed, I need to sum only
none completed orders
CommandeAnnulee : states if order was cancelled, I need to sum only
live orders

Any clues?

Thanks guys.

Dominic.


I tried to change the table names to remove que ":" and the space.
Here is the last version of the equation, which returns a 3464 runtime.

CommDelaisEntree.Value = DSum("[CommValeur]", "CommandeIngenierie",
"[CommCompletee] = 'No' And [CommAnnulee] = 'No'") * 0.07 / 42 / 37.5 /
3.25

More clues?


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.