Update a Table with a calculated field in Forms

V

vince

Is there a way for me to update a field in a Table from a
form? I have 3 fields in a table; First Name; Last Name;
Full Name. Using a form based on the table I want to
update the table field "Full Name" to be a calculated
result of [first name]&" "&[last name]in a form.

I remember reading that calculated fields in forms cannot
update fields in tables. But is there a way that it can
be done?

I will appreciate any input...
 
S

Sandra Daigle

Hi Vince,

You really shouldn't store the calculated value in your table. In a
normalized database, you should not store any value that can be derived from
two or more fields since the derived value is invalid as soon as one of the
independant fields is updated. Instead of trying to keep a calculated field
insync with its source fields it is better to calculate the value when you
need it. In your form you can create a new control, then in the
Controlsource of the new control put the following:

=[first name] & " " & [last name]
 
L

Linda

Hi Sandra,

When I do this, I always make a query then concatenate my 2 fields for a
Full Name. I always thought I had to use my query to make the form from.
What exactly is the control you describe below? Will it create a new query
that can be seen in the query tab or is stored in a different place? If so,
how could I use it for another form? Hope this makes sense.

Thanks,
Linda




Sandra Daigle said:
Hi Vince,

You really shouldn't store the calculated value in your table. In a
normalized database, you should not store any value that can be derived from
two or more fields since the derived value is invalid as soon as one of the
independant fields is updated. Instead of trying to keep a calculated field
insync with its source fields it is better to calculate the value when you
need it. In your form you can create a new control, then in the
Controlsource of the new control put the following:

=[first name] & " " & [last name]


--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
Is there a way for me to update a field in a Table from a
form? I have 3 fields in a table; First Name; Last Name;
Full Name. Using a form based on the table I want to
update the table field "Full Name" to be a calculated
result of [first name]&" "&[last name]in a form.

I remember reading that calculated fields in forms cannot
update fields in tables. But is there a way that it can
be done?

I will appreciate any input...
 
V

vince

Thank you Linda, Sandra and John for you input.

This is what I want to do..

I work for three radio stations. I want to build an entry
form for the DJ's to use and keep track of the prize
winners. Here is the sequence of the fields:


TODAY'S DATE
The DJ would look for his name on a combo box (based on a
table that lists the DJ's Name and the Station Call
Letters)
Based on the DJ Name the STATION field gets filled
automatically.
Enter First Name
Enter Last Name
Calculate Full Name

Once Full Name Fills in open a Subform that displays
STATION, DATE WON, DJ NAME, FULL NAME, PHONE#, PRIZE WON

Then continue entering the winner's phone #
Enter Prize (based on a combo box based on a PRIZE Table)
End

The subform would be based on a complete table or query
that does have the DJ Name, Full Name, and Station. These
fields I am having trouble in connecting.

The subform is based on the Full Name (a calculated field)
it should also show the different Station the winner won
in.

The DJ is talking to the winner on the phone as he enters
the data. Winners are supposed to win once every two
weeks. If the winner did win in less than two weeks, then
DJ can say to the winner, "I see you have won such and
such prize and you should only participate once every two
weeks"

Therefore the subform needs to lookup the FULL NAME and
retrieve all the other information.

I am still looking for a way to make the STATIO field auto
fill based on the DJ name (which can be a combo box)in a
query. (How do you refer to Queries in functions?) I
tried the Dlookup,and the Column functions.

Then I can base my form on a query.
-----Original Message-----
Hi Linda,

You can do it in the query or in control on a form or control on a report
for that matter. If you are in the habit of making reusable queries, then it
makes sense to do it in the query so that you can easily use it anywhere the
calculated field is required.

When you create a calculated control on a form or report the recordsource
query is unchanged.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
Hi Sandra,

When I do this, I always make a query then concatenate my 2 fields for a
Full Name. I always thought I had to use my query to make the form from.
What exactly is the control you describe below? Will it create a new
query that can be seen in the query tab or is stored in a different
place? If so, how could I use it for another form? Hope this makes
sense.

Thanks,
Linda




Sandra Daigle said:
Hi Vince,

You really shouldn't store the calculated value in your table. In a
normalized database, you should not store any value that can be derived
from two or more fields since the derived value is invalid as soon as
one of the independant fields is updated. Instead of trying to keep a
calculated field insync with its source fields it is better to calculate
the value when you need it. In your form you can create a new control,
then in the Controlsource of the new control put the following:

=[first name] & " " & [last name]


--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

vince wrote:
Is there a way for me to update a field in a Table from a
form? I have 3 fields in a table; First Name; Last Name;
Full Name. Using a form based on the table I want to
update the table field "Full Name" to be a calculated
result of [first name]&" "&[last name]in a form.

I remember reading that calculated fields in forms cannot
update fields in tables. But is there a way that it can
be done?

I will appreciate any input...

.
 

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

Similar Threads


Top