Default Value for Field in either Form or Table

C

Cadstillo

I need to create a default value that updates the source table. I need to be
able to do this in either the Form or the Source Table.

This is what I am doing.

Fields
___________
FirstName
LastName
FamilyName

I want the default value of FamilyName to automatically be LastName &
FirstName. Can this be done so that it updates the Source Table?

So far I have run into problems.
 
K

Keith Wilby

Cadstillo said:
I need to create a default value that updates the source table. I need to
be
able to do this in either the Form or the Source Table.

This is what I am doing.

Fields
___________
FirstName
LastName
FamilyName

I want the default value of FamilyName to automatically be LastName &
FirstName. Can this be done so that it updates the Source Table?

You don't need to do this, some will say you MUST not do this. FamilyName
is a calculated field for a query -
FamilyName: LastName & ", " & FirstName

As a general rule of thumb, any value that can be calculated should not be
stored.

HTH - Keith.
www.keithwilby.com
 
C

Cadstillo

Thanks for the tip. That is a good point. I achieved my goal in VBA but, if
it isnt a best practice. I wont do it.
 
S

Steve Schapel

Cadstillo,

Well, it depends on what you really mean. Your original post said
"default value". If the FamilyName will *always* be LastName &
FirstName, then Keith is right... just use a calculated field in a
query, or calculated control on your form or report whenever you need
this value. However, if by "default" you were implying that FamilyName
will *usually* be LastName & FirstName, but there will be times when you
may want to vary this, then you need a separate field to store the value
required.
 

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

Top