Calculation field...HELP!

  • Thread starter Thread starter erick-flores
  • Start date Start date
E

erick-flores

txtboxtest = 3 (control on a form, doesnot exist on a table)
I need to txtboxtotal (control on a form and does exist on a table) =
txtboxtest
I want to see the result from txtboxtest IN my table. The table name is
MainTable.
How do I pass that value to my table? I know how to do some
calculation, but this one got me
I know there is a way to do a query and all that....but i dont want
that, i want it this way, is it posibble?

Please helppp...im going crazy with this one
 
Can you link the tables in any way. If so then run a query with both
tables and you can just use the =sum() function in your form. Maybe a
junction table could join them.

If for some reason you just cannot link the tables try using.

Do you need a total of a field from a another table on your form that
is controled by a different table?

If so use

DSum(expr, domain, [criteria])

The DSum function has the following arguments.

Argument Description
expr An expression that identifies the numeric field whose values you
want to total. It can be a string expression identifying a field in a
table or query, or it can be an expression that performs a calculation
on data in that field. In expr, you can include the name of a field in
a table, a control on a form, a constant, or a function. If expr
includes a function, it can be either built-in or user-defined, but not
another domain aggregate or SQL aggregate function.
domain A string expression identifying the set of records that
constitutes the domain. It can be a table name or a query name for a
query that does not require a parameter.
criteria An optional string expression used to restrict the range of
data on which the DSum function is performed. For example, criteria is
often equivalent to the WHERE clause in an SQL expression, without the
word WHERE. If criteria is omitted, the DSum function evaluates expr
against the entire domain. Any field that is included in criteria must
also be a field in domain; otherwise, the DSum function returns a Null.
 
gumby said:
Can you link the tables in any way. If so then run a query with both
tables and you can just use the =sum() function in your form. Maybe a
junction table could join them.

If for some reason you just cannot link the tables try using.

Do you need a total of a field from a another table on your form that
is controled by a different table?

If so use

DSum(expr, domain, [criteria])

The DSum function has the following arguments.

Argument Description
expr An expression that identifies the numeric field whose values you
want to total. It can be a string expression identifying a field in a
table or query, or it can be an expression that performs a calculation
on data in that field. In expr, you can include the name of a field in
a table, a control on a form, a constant, or a function. If expr
includes a function, it can be either built-in or user-defined, but not
another domain aggregate or SQL aggregate function.
domain A string expression identifying the set of records that
constitutes the domain. It can be a table name or a query name for a
query that does not require a parameter.
criteria An optional string expression used to restrict the range of
data on which the DSum function is performed. For example, criteria is
often equivalent to the WHERE clause in an SQL expression, without the
word WHERE. If criteria is omitted, the DSum function evaluates expr
against the entire domain. Any field that is included in criteria must
also be a field in domain; otherwise, the DSum function returns a Null.
I only have one table.

What I want is just store the number in one of the field in my table.
This number comes from a control in my form. It sounds so simple, I
dont know whi its so complicated :'(
 
I am sorry, I guess I do not understand what you are trying to do. If
it comes from a control in your form then it already exsist in your
table? No need to dublicate that data by placing it into another field
in the same table.

erick-flores said:
gumby said:
Can you link the tables in any way. If so then run a query with both
tables and you can just use the =sum() function in your form. Maybe a
junction table could join them.

If for some reason you just cannot link the tables try using.

Do you need a total of a field from a another table on your form that
is controled by a different table?

If so use

DSum(expr, domain, [criteria])

The DSum function has the following arguments.

Argument Description
expr An expression that identifies the numeric field whose values you
want to total. It can be a string expression identifying a field in a
table or query, or it can be an expression that performs a calculation
on data in that field. In expr, you can include the name of a field in
a table, a control on a form, a constant, or a function. If expr
includes a function, it can be either built-in or user-defined, but not
another domain aggregate or SQL aggregate function.
domain A string expression identifying the set of records that
constitutes the domain. It can be a table name or a query name for a
query that does not require a parameter.
criteria An optional string expression used to restrict the range of
data on which the DSum function is performed. For example, criteria is
often equivalent to the WHERE clause in an SQL expression, without the
word WHERE. If criteria is omitted, the DSum function evaluates expr
against the entire domain. Any field that is included in criteria must
also be a field in domain; otherwise, the DSum function returns a Null.
I only have one table.

What I want is just store the number in one of the field in my table.
This number comes from a control in my form. It sounds so simple, I
dont know whi its so complicated :'(
 
Have you tried the property Default Value =[FieldName] then have that
control set to your table field you want to populate.

erick-flores said:
gumby said:
Can you link the tables in any way. If so then run a query with both
tables and you can just use the =sum() function in your form. Maybe a
junction table could join them.

If for some reason you just cannot link the tables try using.

Do you need a total of a field from a another table on your form that
is controled by a different table?

If so use

DSum(expr, domain, [criteria])

The DSum function has the following arguments.

Argument Description
expr An expression that identifies the numeric field whose values you
want to total. It can be a string expression identifying a field in a
table or query, or it can be an expression that performs a calculation
on data in that field. In expr, you can include the name of a field in
a table, a control on a form, a constant, or a function. If expr
includes a function, it can be either built-in or user-defined, but not
another domain aggregate or SQL aggregate function.
domain A string expression identifying the set of records that
constitutes the domain. It can be a table name or a query name for a
query that does not require a parameter.
criteria An optional string expression used to restrict the range of
data on which the DSum function is performed. For example, criteria is
often equivalent to the WHERE clause in an SQL expression, without the
word WHERE. If criteria is omitted, the DSum function evaluates expr
against the entire domain. Any field that is included in criteria must
also be a field in domain; otherwise, the DSum function returns a Null.
I only have one table.

What I want is just store the number in one of the field in my table.
This number comes from a control in my form. It sounds so simple, I
dont know whi its so complicated :'(
 
erick-flores said:
txtboxtest = 3 (control on a form, doesnot exist on a table)
I need to txtboxtotal (control on a form and does exist on a table) =
txtboxtest
I want to see the result from txtboxtest IN my table. The table name is
MainTable.
How do I pass that value to my table? I know how to do some
calculation, but this one got me
I know there is a way to do a query and all that....but i dont want
that, i want it this way, is it posibble?

Please helppp...im going crazy with this one

Umm... bind the txtTotal control to the table?
 
so what happens if you have:
(option 1) a hidden control on your form and set the controlsource to
whatever function you want. Bind said control to table.

(option 2) calculate the value of the (no longer existent hiidden
control) and update it in the BeforeInsert/BeforeUpdate events of the
form.

or
(option 3)
just calculate on the fly... hey, wait... that's what queries are
for!!!! How 'bout that?!!!
 
Back
Top