save data unbound text box

  • Thread starter soldier in afghanistan
  • Start date
S

soldier in afghanistan

i am having a bit of a snag. i have a text box pulling data from 3 other
text boxes and i need to save it to my database. heres how my textbox shows
the data.

CM-0001

the C is the company
the M is the first initial of the persons last name
the 0001 is the last four of the persons social

i have this info in a text box that i have pulled from other textboxes and i
want to save it to a field. i have no idea how to save this data. the
textbox is bound to the other textboxes. is there some way to save this in
an expression or something?
 
D

Douglas J. Steele

Why do you think you need to store that? Since the other 3 pieces of
information already exist in the table, it would actually be a violation of
database normalization principles to store such a field.

Instead, create a query based on your table. Add a computed field in that
query that computes the data the way you need it: [Company] &
Left([Surname], 1) & Right([SSN], 4)

Use the query wherever you would otherwise have used the table.
 
S

soldier in afghanistan

i thought i needed to store it becuse i will need to print out reports with
that information. will i still be able to spit out reports with that info on
it? could you please instruct me a little better on how to set up such a
query? this has been an on the spot problem and my book is over a hundred
miles away. any help would make my life easier here in this wonderful
country.

Douglas J. Steele said:
Why do you think you need to store that? Since the other 3 pieces of
information already exist in the table, it would actually be a violation of
database normalization principles to store such a field.

Instead, create a query based on your table. Add a computed field in that
query that computes the data the way you need it: [Company] &
Left([Surname], 1) & Right([SSN], 4)

Use the query wherever you would otherwise have used the table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



soldier in afghanistan said:
i am having a bit of a snag. i have a text box pulling data from 3 other
text boxes and i need to save it to my database. heres how my textbox
shows
the data.

CM-0001

the C is the company
the M is the first initial of the persons last name
the 0001 is the last four of the persons social

i have this info in a text box that i have pulled from other textboxes and
i
want to save it to a field. i have no idea how to save this data. the
textbox is bound to the other textboxes. is there some way to save this
in
an expression or something?
 
D

Douglas J. Steele

Create the query how you ordinarily would. In the grid that lists all of the
fields that you've included in the query, pick a blank column, and type what
I had below into the cell on the Field row.

Assuming you want this new field to be called something like NewId, preface
the computation with that name:

NewId: [Company] & Left([Surname], 1) & Right([SSN], 4)

(replace Company, Surname and SSN with whatever your fields are named)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



soldier in afghanistan said:
i thought i needed to store it becuse i will need to print out reports with
that information. will i still be able to spit out reports with that info
on
it? could you please instruct me a little better on how to set up such a
query? this has been an on the spot problem and my book is over a hundred
miles away. any help would make my life easier here in this wonderful
country.

Douglas J. Steele said:
Why do you think you need to store that? Since the other 3 pieces of
information already exist in the table, it would actually be a violation
of
database normalization principles to store such a field.

Instead, create a query based on your table. Add a computed field in that
query that computes the data the way you need it: [Company] &
Left([Surname], 1) & Right([SSN], 4)

Use the query wherever you would otherwise have used the table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



"soldier in afghanistan" <soldier in
[email protected]>
wrote in message
i am having a bit of a snag. i have a text box pulling data from 3
other
text boxes and i need to save it to my database. heres how my textbox
shows
the data.

CM-0001

the C is the company
the M is the first initial of the persons last name
the 0001 is the last four of the persons social

i have this info in a text box that i have pulled from other textboxes
and
i
want to save it to a field. i have no idea how to save this data. the
textbox is bound to the other textboxes. is there some way to save
this
in
an expression or something?
 
J

John Vinson

i thought i needed to store it becuse i will need to print out reports with
that information.

Simply base the Report on the Query, or use the same expression in the
control source of a textbox on the Report.

It's a very common assumption that you must have data stored in a
table to report it (perhaps this comes from dBase or some other
programs which use this technique); however, it's not the case for
Access. You can and usually should base a Report - not on a Table -
but on a Query.

John W. Vinson[MVP]
 
Top