Solved

Access: Create query that displays 2 merged fields

Posted on 2007-11-27
4
191 Views
Last Modified: 2010-03-20
I have a table (Name:"dates" Columns: "Month", "Year")

In query mode, if I choose the table above as the source, how would I create a field that would be a combination of the "Month" and "Year" Fields.

i.e.  Insert this into  a new field in query view----> MonthandYear: [Month]+""+[Year]

In other words how do I make the syntax above work?
0
Comment
Question by:ouestque
  • 2
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 20359476
select  [Month]&" "&[Year] from tableName  

0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 420 total points
ID: 20359493
if you don't want a space in between

select  [Month],[Year], [Month]&[Year] as MonthAndYear from dates  
0
 
LVL 40

Assisted Solution

by:Richard Quadling
Richard Quadling earned 80 total points
ID: 20359565
In SQL server, & doesn't cut it.

Try ...


SELECT CAST(Month AS VarChar) + CAST(Year As VarChar)

So, watch out for portability of any query you write.
0
 

Author Comment

by:ouestque
ID: 20361444
Thanks guys!!! Caps solution worked and he had the first response, but RQuadling had a SQL compabaility solution. Cap gets majority points., but RQ gets a little to for the effort.

Thanks again!!!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question