Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 25th, 2007, 08:54 AM
Registered User
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default Query Problem.

any function in Query in Access to get month name e.g. 2/1/2007 should return to February,

and any function to concatenate string in Query (SQL Mode)?

Rupen Anjaria.:)
We CAN'T avoid problems, but can solve it.
Old April 26th, 2007, 11:40 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

SQL supports DATENAME(), but Access ANSI SQL 89 does not support this. I suggest a select case function, like GetMonth()

Public sMonth As String
Function GetMonth(iMonth As Integer)
Select Case iMonth
    Case 1
    sMonth = "January"
    Case 2
    sMonth = "February"
End Select
GetMonth = sMonth
End Function

Then just call this from your code (but not your SQL... do it on a form or report Detail on format event.

Yes, just use the query designer and regular expressions in Field line. For example, if you have two names in your table called "LastName" and "FirstName" and you want to display them as one field LastName, FirstName, then in the field line of the query designer, do this:

FullName:([LastName] & ", " & [FirstName])

This will take this:

LastName FirstName
Smith John

And display it in the column as

Smith, John

Did that help?

Old April 27th, 2007, 07:04 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

What about just

Format(YourDateHere, "mmmm")

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Old April 27th, 2007, 07:43 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Hey, what about that? I never knew about the MMMM format. I will have to go back and peruse that reference.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query Problem bundersuk VB Databases Basics 0 December 30th, 2006 07:50 AM
query problem purnendu2311 Other Programming Languages 2 December 1st, 2006 02:53 PM
problem with query harpua Classic ASP Databases 1 January 24th, 2005 12:36 PM
Problem in query leo_vinay Classic ASP Databases 5 January 21st, 2005 06:32 AM
query problem mateenmohd SQL Server 2000 7 September 9th, 2003 11:58 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.