Combining Text Stings

M

mcl

I wanted to combine the values in several fields into one in a query (Access
2000). Help said there was a worksheet function concatenate. When I tried it
I got an undefined function error. So what's the story here?
 
V

Van T. Dinh

"Worksheet function Concatenate" sounds like an Excel function, NOT Access.

The concatenate operator is "&". Try:

SELECT Fieldl & " " & Field2 As Combined
FROM YourTable

See Access Help on concatenation.
 
M

mcl

OK, I approached it just using "&" to combine the fields but now I have
another problem. I have three fields year, mo, day. I wanted to combine them
into one date field. Which I have as mo/day/year using "&" on the fields. I
have them formatted as short date but Access obviously still doesn't know
it's a date. When I sort on it, it just treats it as a text string and sorts
on the first character and even screws up there because of the typical
problem where10,11,12 come before 2-9. How do I get this to work.
 
D

Dale Fye

If the three fields are numeric, you can use the dateserial function
to generate a column that will be of date datatype.

DateField: Dateserial([fldYear], [fldMonth], [fldDay])

--
HTH

Dale Fye


OK, I approached it just using "&" to combine the fields but now I
have
another problem. I have three fields year, mo, day. I wanted to
combine them
into one date field. Which I have as mo/day/year using "&" on the
fields. I
have them formatted as short date but Access obviously still doesn't
know
it's a date. When I sort on it, it just treats it as a text string and
sorts
on the first character and even screws up there because of the typical
problem where10,11,12 come before 2-9. How do I get this to work.
 

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