Ok, I think I did something wrong
I did the query just as you said, but when I open the table back up, I see
this:
chrFirstName chrLastName chrCombinedName
Jennifer Cali chrFirstName chrLastName
Jack Traper chrFirstName chrLastName
Andy Zoller chrFirstName chrLastName
It seems to be reading my entry as text and not as a formula. How do I make
it read as a formula to show the combined name and not (what appears to be)
the formula I entered?
--
Thank you! - Jennifer
:
Hi, Jennifer. The simple answer is that you can't do calculations in a table.
Tables are static; they hold stuff. However, we can use queries to make
lots of calculations, and store the results back in the table. Queries are
dynamic; they DO stuff.
So, let's say that you have a "Contacts" table and you have two fields
FirstName and LastName. You want to fill in the field FullName in the
Contacts table which will contain the FirstName, a space, and the LastName.
Create a query and add the Contacts table to it. Drag the three fields
FirstName, LastName and FullName into the query window.
Change your query to an Update Query, and click in the "Update To" row of
the FullName field. Type in the following:
FirstName & " " & LastName
When you run the query, it will fill in the FullName for each record as
"FirstName LastName" (with the space between them).
However, you probably wouldn't want to actually store the FullName in the
table; you don't need to. You'll want the FullName in reports, sure, but you
can calculate it on the fly using almost the same syntax in the report that
you would have used in the update query.
Or, create a query and put in your Firstname and LastName fields as before.
( In this example, we'll say that you don't have a FullName column, just
First and Last.) Then in the third column of the query, in the top row, type
the following:
FullName: FirstName & " " & LastName
Whenever you run the query, you'll see three columns; the two from your
table, and the FullName column calculated whenever you need it. Then you can
base your forms and reports on the Query and not on the table.
Play around with this idea. Remember that Access is a real "division of
labor" program; each part of the database (tables, queries, forms and
reports) do one thing well. Use the part that does each job best.
:
I'm trying to figure out how to have a field in a table that is a calculated
value. Is that possible? I have two fields: chrFirstName and chrLastName. I
want the calculated field to be something like: "=[chrFirstname] & " " &
[chrLastName]". Do I input this? I've been reading on the append queries;
would that solve the issue? I came across this: "you can create a full name
calculated field by combining the text from the first name and last name
fields. You can then append the full name values to a full name field in a
table." That sounds like what I want but I have NO idea how to do that. I
only have one table: tblName - do I need two? Where would the calculated
field reside?