PC Review


Reply
Thread Tools Rate Thread

Converting numeric date to string, then trimming it

 
 
Santiago Gomez
Guest
Posts: n/a
 
      13th Nov 2003
I have a table with a date field. I need to group it by month.
I was thinking I could turn the number (37178) into a string (14-Oct-01) and
then trim the left3 and right 3 to just leave Oct.
Then I could group it by month.

Is there a better way of doing this?

what would the SQL statement look like?

thanks


 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      13th Nov 2003
Create two calculated fields in your query:
ThisYear: Year([MyDate])
ThisMonth: Month([MyDate])
Group by those fields.

If this query is the source for a report, the Sorting And Grouping dialog is
capable of grouping by month.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Santiago Gomez" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a table with a date field. I need to group it by month.
> I was thinking I could turn the number (37178) into a string (14-Oct-01)

and
> then trim the left3 and right 3 to just leave Oct.
> Then I could group it by month.
>
> Is there a better way of doing this?
>
> what would the SQL statement look like?
>
> thanks
>
>



 
Reply With Quote
 
 
 
 
Van T. Dinh
Guest
Posts: n/a
 
      13th Nov 2003
Easier than you think:

?Format(37178, "mmm")
Oct

Use Allen's Month & Year for Sorting and Grouping in Reports.

--
HTH
Van T. Dinh
MVP (Access)



"Santiago Gomez" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a table with a date field. I need to group it by month.
> I was thinking I could turn the number (37178) into a string (14-Oct-01)

and
> then trim the left3 and right 3 to just leave Oct.
> Then I could group it by month.
>
> Is there a better way of doing this?
>
> what would the SQL statement look like?
>
> thanks
>
>



 
Reply With Quote
 
Santiago Gomez
Guest
Posts: n/a
 
      14th Nov 2003
Thanks that worked.

"Van T. Dinh" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Easier than you think:
>
> ?Format(37178, "mmm")
> Oct
>
> Use Allen's Month & Year for Sorting and Grouping in Reports.
>
> --
> HTH
> Van T. Dinh
> MVP (Access)
>
>
>
> "Santiago Gomez" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I have a table with a date field. I need to group it by month.
> > I was thinking I could turn the number (37178) into a string (14-Oct-01)

> and
> > then trim the left3 and right 3 to just leave Oct.
> > Then I could group it by month.
> >
> > Is there a better way of doing this?
> >
> > what would the SQL statement look like?
> >
> > thanks
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Arithmetic overflow error converting numeric to data type numeric John Microsoft Access Queries 0 1st Nov 2004 10:24 AM
Re: Arithmetic overflow error converting numeric to data type numeric John Microsoft Access 0 1st Nov 2004 10:24 AM
Re: Arithmetic overflow error converting numeric to data type numeric Leonardo Ezequiel Weite Microsoft Access Queries 0 8th Sep 2004 12:50 AM
Re: Arithmetic overflow error converting numeric to data type numeric Leonardo Ezequiel Weite Microsoft Access 0 8th Sep 2004 12:50 AM
Trimming Numeric Values From Text. Nick Microsoft Access Queries 2 21st Apr 2004 02:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:25 AM.