can i do at time of data input

  • Thread starter Thread starter _Bigred
  • Start date Start date
B

_Bigred

when I put a record in the db I enter

LastName
FirstName
InmateNumber
ArrivalDate

Is there anyway that when the user inputs the LastName & FirstName, a column
is added that would automatically add OffenderName (i.e.
LastName,FirstName). So I don't have to try doing it with a update query
that would join them in the desired field?

TIA,
_Bigred
 
You should not store slightly different variations of the same data, in
a table, like that. You should put the fields together, in different
combinations, as & when you want them, by using a query. For example:

SELECT Firstname, Lastname, Lastname & ", " & Firstname FROM
YourTableName

Look up queries in online help.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 
when I put a record in the db I enter

LastName
FirstName
InmateNumber
ArrivalDate

Is there anyway that when the user inputs the LastName & FirstName, a column
is added that would automatically add OffenderName (i.e.
LastName,FirstName). So I don't have to try doing it with a update query
that would join them in the desired field?

You should not store this field in ANY table, AT ALL.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox:
=[LastName] & ", " & [FirstName]

John W. Vinson[MVP]
 
TC - I currently use the query method Offender:[LastName]&","&[FirstName]
which ultimately would take:
LastName FirstName
Doe John

and gives me Doe, John - I just use the query as the source for the
Offender. So in essence I pull the inmates first & last name from my main
table using a query and then use it (query) as my source of a JobAssignment
table.

Thanks,
_Bigred
 
Thanks John - I currently use the query method
Offender:[LastName]&","&[FirstName]
which ultimately would take:
LastName FirstName
Doe John

and gives me Doe, John - I just use the query as the source for the
Offender. So in essence I pull the inmates first & last name from my main
table using a query and then use it (query) as my source of a JobAssignment
table.

Thanks,
_Bigred


John Vinson said:
when I put a record in the db I enter

LastName
FirstName
InmateNumber
ArrivalDate

Is there anyway that when the user inputs the LastName & FirstName, a
column
is added that would automatically add OffenderName (i.e.
LastName,FirstName). So I don't have to try doing it with a update query
that would join them in the desired field?

You should not store this field in ANY table, AT ALL.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox:
=[LastName] & ", " & [FirstName]

John W. Vinson[MVP]
 
But do you have this in one table:
FORNAME: John
SURNAE: Smith

and this in some /other/ table: ?
OFFENDER: Smith, John

If so, my & John's comments still hold: you should /not/ be storing
that variation of the person name. You should identify each person with
a unique Person ID, then you can store their /Person ID/ in other
tables, to link those records to that person.

TC MVP (Access)
http://tc2.atspace.com
 
Thanks John - I currently use the query method
Offender:[LastName]&","&[FirstName]
which ultimately would take:
LastName FirstName
Doe John

and gives me Doe, John - I just use the query as the source for the
Offender. So in essence I pull the inmates first & last name from my main
table using a query and then use it (query) as my source of a JobAssignment
table.

Don't.

That's a BIG MISTAKE.

Your JobAssignment table should *not contain any names at all*. It
should contain *only* the unique InmateID.

What if you had two inmates both named Robert Smith - with different
levels of trustworthiness? Your approach would give you a job
assignment list with "Smith, Robert" on it: is that Bob, the nice guy
short-timer who you'ld trust to take a bag of cash to the bank to
deposit, or Rugged Robert that you wouldn't turn your back on?

John W. Vinson[MVP]
 

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

Back
Top