Update table field from expression in form

A

AusTexRich

="M" & Format([PROPYR],"yy")+"-" & Format([PROP_CT],"00000")

I want the results of the expression to be saved to the table in a
particular field.

How can I do this?

Thank
 
K

Klatuu

Depends on what you are doing and what the objects are.
What is [PROPYR] ? is it a field in the form's recordset or is it the name
of a control on your form? Same question for [PROP_CT]

First, you will need a Text Box control on your form bound to the field.

Then you have to determine when you have both pieces of information
available. Then assign the result of the calculation to the bound control.

BUT!

The real answer is don't do it. Storing calculated values in tables
violates database normalization rules. It only waste space and time to store
a calculated value and sooner or later, it will become inaccurate. The
better practice is to calculate the value only when needed to present to
humans.
 
A

AusTexRich

[PROPYR] is a date (two digit date) and [PROP_CT] is an auto number (from
the table). And I want to convert it to text and stick it into a text field
in the table. That's an issue.
--
AusTexRich


Klatuu said:
Depends on what you are doing and what the objects are.
What is [PROPYR] ? is it a field in the form's recordset or is it the name
of a control on your form? Same question for [PROP_CT]

First, you will need a Text Box control on your form bound to the field.

Then you have to determine when you have both pieces of information
available. Then assign the result of the calculation to the bound control.

BUT!

The real answer is don't do it. Storing calculated values in tables
violates database normalization rules. It only waste space and time to store
a calculated value and sooner or later, it will become inaccurate. The
better practice is to calculate the value only when needed to present to
humans.
--
Dave Hargis, Microsoft Access MVP


AusTexRich said:
="M" & Format([PROPYR],"yy")+"-" & Format([PROP_CT],"00000")

I want the results of the expression to be saved to the table in a
particular field.

How can I do this?

Thank
 
K

Klatuu

Okay, they are table fields, then.
Are you wanting to do this on a form, in a query, or in recordset processing?

--
Dave Hargis, Microsoft Access MVP


AusTexRich said:
[PROPYR] is a date (two digit date) and [PROP_CT] is an auto number (from
the table). And I want to convert it to text and stick it into a text field
in the table. That's an issue.
--
AusTexRich


Klatuu said:
Depends on what you are doing and what the objects are.
What is [PROPYR] ? is it a field in the form's recordset or is it the name
of a control on your form? Same question for [PROP_CT]

First, you will need a Text Box control on your form bound to the field.

Then you have to determine when you have both pieces of information
available. Then assign the result of the calculation to the bound control.

BUT!

The real answer is don't do it. Storing calculated values in tables
violates database normalization rules. It only waste space and time to store
a calculated value and sooner or later, it will become inaccurate. The
better practice is to calculate the value only when needed to present to
humans.
--
Dave Hargis, Microsoft Access MVP


AusTexRich said:
="M" & Format([PROPYR],"yy")+"-" & Format([PROP_CT],"00000")

I want the results of the expression to be saved to the table in a
particular field.

How can I do this?

Thank
 
A

AusTexRich

I have the results in a form. I'd like to get them into the table.
--
AusTexRich


Klatuu said:
Okay, they are table fields, then.
Are you wanting to do this on a form, in a query, or in recordset processing?

--
Dave Hargis, Microsoft Access MVP


AusTexRich said:
[PROPYR] is a date (two digit date) and [PROP_CT] is an auto number (from
the table). And I want to convert it to text and stick it into a text field
in the table. That's an issue.
--
AusTexRich


Klatuu said:
Depends on what you are doing and what the objects are.
What is [PROPYR] ? is it a field in the form's recordset or is it the name
of a control on your form? Same question for [PROP_CT]

First, you will need a Text Box control on your form bound to the field.

Then you have to determine when you have both pieces of information
available. Then assign the result of the calculation to the bound control.

BUT!

The real answer is don't do it. Storing calculated values in tables
violates database normalization rules. It only waste space and time to store
a calculated value and sooner or later, it will become inaccurate. The
better practice is to calculate the value only when needed to present to
humans.
--
Dave Hargis, Microsoft Access MVP


:

="M" & Format([PROPYR],"yy")+"-" & Format([PROP_CT],"00000")

I want the results of the expression to be saved to the table in a
particular field.

How can I do this?

Thank
 
K

Klatuu

Okay, you gave me the field names for the table, What are the control names
of the controls to which the fields are bound? In what order are they
normally entered?

--
Dave Hargis, Microsoft Access MVP


AusTexRich said:
I have the results in a form. I'd like to get them into the table.
--
AusTexRich


Klatuu said:
Okay, they are table fields, then.
Are you wanting to do this on a form, in a query, or in recordset processing?

--
Dave Hargis, Microsoft Access MVP


AusTexRich said:
[PROPYR] is a date (two digit date) and [PROP_CT] is an auto number (from
the table). And I want to convert it to text and stick it into a text field
in the table. That's an issue.
--
AusTexRich


:

Depends on what you are doing and what the objects are.
What is [PROPYR] ? is it a field in the form's recordset or is it the name
of a control on your form? Same question for [PROP_CT]

First, you will need a Text Box control on your form bound to the field.

Then you have to determine when you have both pieces of information
available. Then assign the result of the calculation to the bound control.

BUT!

The real answer is don't do it. Storing calculated values in tables
violates database normalization rules. It only waste space and time to store
a calculated value and sooner or later, it will become inaccurate. The
better practice is to calculate the value only when needed to present to
humans.
--
Dave Hargis, Microsoft Access MVP


:

="M" & Format([PROPYR],"yy")+"-" & Format([PROP_CT],"00000")

I want the results of the expression to be saved to the table in a
particular field.

How can I do this?

Thank
 
A

AusTexRich

[PROP_BLD] contains the entire expression that's bound to the form. [PROPYR]
is just a date in the query behind the form. (I supposed I could have done
that on the form.) When my "number" is formed it looks like "M07-00001". I
don't enter anything. The number is created when a new line is added.
--
AusTexRich


Klatuu said:
Okay, you gave me the field names for the table, What are the control names
of the controls to which the fields are bound? In what order are they
normally entered?

--
Dave Hargis, Microsoft Access MVP


AusTexRich said:
I have the results in a form. I'd like to get them into the table.
--
AusTexRich


Klatuu said:
Okay, they are table fields, then.
Are you wanting to do this on a form, in a query, or in recordset processing?

--
Dave Hargis, Microsoft Access MVP


:

[PROPYR] is a date (two digit date) and [PROP_CT] is an auto number (from
the table). And I want to convert it to text and stick it into a text field
in the table. That's an issue.
--
AusTexRich


:

Depends on what you are doing and what the objects are.
What is [PROPYR] ? is it a field in the form's recordset or is it the name
of a control on your form? Same question for [PROP_CT]

First, you will need a Text Box control on your form bound to the field.

Then you have to determine when you have both pieces of information
available. Then assign the result of the calculation to the bound control.

BUT!

The real answer is don't do it. Storing calculated values in tables
violates database normalization rules. It only waste space and time to store
a calculated value and sooner or later, it will become inaccurate. The
better practice is to calculate the value only when needed to present to
humans.
--
Dave Hargis, Microsoft Access MVP


:

="M" & Format([PROPYR],"yy")+"-" & Format([PROP_CT],"00000")

I want the results of the expression to be saved to the table in a
particular field.

How can I do this?

Thank
 
A

AusTexRich

OK it looks as though you given up. Thanks for your help anyway. I think
that I'll just add the number to the table using an update query. I'll
figure something more clever later. That'll have to do for the present.
 
Top