Thread: Query Problem.
View Single Post
Old April 26th, 2007, 11:40 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
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?