Text box value based on sum of another text box

D

dominic_brunelle

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.
 
D

dominic_brunelle

Klatuu said:
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.


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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top