creating a concatenated field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to combine 3 fields with 3 different data types: string, date
and integer. I would like to combine them into a string. What do I need to
do to convert the datea nd integer values into strings in order to save the 3
together as a string field. I would like to do this with in the query.

Thanks!
 
If you are using Access you should be able to use the "&" concatention
operator.

Field: Combined: StringField & DateField & integerField.

Are any of the fields ever Null? If so, what do you want to display for the
null values

Do you want specific formats for the date and integer fields? For example,
numbers should be five characters long with leading zeroes; dates should be
in the format "mm-dd-yyyy".

Do you want separators between the values in the sections?



--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
I want the date to just read as numbers such as 20070405 and all spaces to be
taken out of the text field so I have one long string. It is going to be
used as a reference key so each will be unique.

Thanks for your assistance.
 
Replace(StringField," ","") & Format(DateField, "yyyymmdd") & IntegerField

Use the replace function to remove all spaces from the string field
Use the format function to return the date as a string in the specified
format

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top