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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|