Solved

Access: Create query that displays 2 merged fields

Posted on 2007-11-27
4
185 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 119

Expert Comment

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

0
 
LVL 119

Accepted Solution

by:
Rey Obrero 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:RQuadling
RQuadling 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now