Tables and Forms

  • Thread starter Thread starter Vince
  • Start date Start date
V

Vince

I am using Access 97. In a table I have a field called
Full Name. I created a form and in that form I want that
field to be set to the First Name and Last Name and for
the value of the form field to go to the Full Name field
in the Table. I understand that the calculated fields in
Form Design do not update the Table fields. Is that an
absolute truth? Does anybody know a way to what I want to
do?

Thanks.
 
The normal way of doing this would be to have two fields in the table for
names - one for FirstName and one for LastName. The FullName can then be
generated any time you want via a query - use the expression FullName:
[FirstName] & " " & [LastName] to generate the full name. For the form you
just have two bound text boxes.

Now, you _could_ store FullName in the table and generate it from two
unbound text boxes on a form - one for FirstName and one for LastName. This
would look the same to the user, but it would not be the right way of doing
it as you will lose a lot of flexibility that you get from having two
separate fields in the table. For example with two fields you can easily:

- sort by LastName
- display the full name as LastName, FirstName
- display just the FirstName or just the LastName

If you have only one field then you can't do any of this. You may think you
will never need to do any of this, but it's quite likely that you will, and
in any case it's not any more work doing it the right way.
 
Vince,

Don't confuse a control on a form with a field in a table nor assume that
what applies to one necessarily applies to the other. The issue isn't that
you can not do a thing but that you should not.

You can, indeed, calculate something on a form and store the result in a
field in a table. What I think you are doing is having your users type in
the person's full name as a first name and a last name. No problem.

When you see people raising a ruckus about storing calculated results it is
usually because a neophyte developer wants to calculate the result of
manipulating two components of a record to achieve some result and then
store that result into the same record. That is a no-no for a couple of
reasons: One or the other source component may change due to some other
process and now the stored result is out of synch with its parts. Disk and
memory utilization. It's a waste of resources to store and manage a result
that you can calculate at will. The calculation takes, relatively speaking,
no space at all but a few bytes in each of a million records can eat up
quite a few resources.

If you are taking the data from two fields and simply displaying it in your
form or printing it in a report then you're doing things properly and :"No
harm, No foul". However, If you are concatenating the data from those two
fields into a single field and storing that new field in the record, that's
a no-no.

hth
 
Back
Top