 |
|
 |
|
Next: Updating Excel Link in PPT
|
| Author |
Message |
External

Since: Dec 3, 2008 Posts: 8
|
(Msg. 1) Posted: Wed Jan 20, 2010 8:16 pm
Post subject: Number To Month Archived from groups: microsoft>public>access (more info?)
|
|
|
My field [month] consists of month in number.
I've been using this expression to convert number to month name
MonthName([Month],True)
My problem is i want to display one month after ..say Jan from 12/Dec
Hope my explaination is clear >> Stay informed about: Number To Month |
|
| Back to top |
|
 |  |
External

Since: Dec 11, 2009 Posts: 2
|
(Msg. 2) Posted: Wed Jan 20, 2010 8:39 pm
Post subject: Re: Number To Month Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Dec 5, 2008 Posts: 8
|
(Msg. 3) Posted: Wed Jan 20, 2010 8:51 pm
Post subject: RE: Number To Month Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Dec 3, 2008 Posts: 8
|
(Msg. 4) Posted: Wed Jan 20, 2010 9:05 pm
Post subject: RE: Number To Month Archived from groups: per prev. post (more info?)
|
|
|
Tried..but with #error
"Duane Hookom" wrote:
> Have you tried to just add 1?
> MonthName([Month]+1)
>
> --
> Duane Hookom
> Microsoft Access MVP
>
>
> "zyus" wrote:
>
> > My field [month] consists of month in number.
> >
> > I've been using this expression to convert number to month name
> >
> > MonthName([Month],True)
> >
> > My problem is i want to display one month after ..say Jan from 12/Dec
> >
> > Hope my explaination is clear >> Stay informed about: Number To Month |
|
| Back to top |
|
 |  |
External

Since: Dec 3, 2008 Posts: 8
|
(Msg. 5) Posted: Wed Jan 20, 2010 10:20 pm
Post subject: Re: Number To Month Archived from groups: per prev. post (more info?)
|
|
|
Tried in query but still error
SELECT [Tbl-SKS].MONTH, MonthName([month],True) AS Expr1, [expr1]+1 AS Expr2
FROM [Tbl-SKS];
"Jeff Boyce" wrote:
> Are you saying that you wish to add 1 to the month? You can do that in a
> query.
>
> --
>
> Regards
>
> Jeff Boyce
> Microsoft Access MVP
>
> Disclaimer: This author may have received products and services mentioned in
> this post. Mention and/or description of a product or service herein does
> not constitute endorsement thereof.
>
> Any code or pseudocode included in this post is offered "as is", with no
> guarantee as to suitability.
>
> You can thank the FTC of the USA for making this disclaimer
> possible/necessary.
>
> "zyus" wrote in message
>
> > My field [month] consists of month in number.
> >
> > I've been using this expression to convert number to month name
> >
> > MonthName([Month],True)
> >
> > My problem is i want to display one month after ..say Jan from 12/Dec
> >
> > Hope my explaination is clear
>
>
> .
> >> Stay informed about: Number To Month |
|
| Back to top |
|
 |  |
External

Since: Nov 28, 2008 Posts: 104
|
(Msg. 6) Posted: Wed Jan 20, 2010 10:41 pm
Post subject: Re: Number To Month Archived from groups: per prev. post (more info?)
|
|
|
On Wed, 20 Jan 2010 20:16:01 -0800, zyus
wrote:
>My field [month] consists of month in number.
>
>I've been using this expression to convert number to month name
>
>MonthName([Month],True)
>
>My problem is i want to display one month after ..say Jan from 12/Dec
>
>Hope my explaination is clear
I'm surprised that Monthname doesn't work; you'ld need to trick it for
December with
MonthName([Month] MOD 12 + 1, True)
If that doesn't work try: Format(DateSerial(2000, [month] + 1, 1), "mmm")
This will convert the month number (an integer from 1 to 12 I presume) to a
Date/Time field containing the first day of the next month (in 2000, or 2001
if the month is 12; the year is arbitrary), and convert that back to a month
name string. >> Stay informed about: Number To Month |
|
| Back to top |
|
 |  |
External

Since: Dec 3, 2008 Posts: 8
|
(Msg. 7) Posted: Wed Jan 20, 2010 10:47 pm
Post subject: Re: Number To Month Archived from groups: per prev. post (more info?)
|
|
|
With this "MonthName([Month] MOD 12 + 1, True)"
It's worked.
Thanks John
"John W. Vinson" wrote:
> On Wed, 20 Jan 2010 20:16:01 -0800, zyus wrote:
>
> >My field [month] consists of month in number.
> >
> >I've been using this expression to convert number to month name
> >
> >MonthName([Month],True)
> >
> >My problem is i want to display one month after ..say Jan from 12/Dec
> >
> >Hope my explaination is clear
>
> I'm surprised that Monthname doesn't work; you'ld need to trick it for
> December with
>
> MonthName([Month] MOD 12 + 1, True)
>
> If that doesn't work try: Format(DateSerial(2000, [month] + 1, 1), "mmm")
>
> This will convert the month number (an integer from 1 to 12 I presume) to a
> Date/Time field containing the first day of the next month (in 2000, or 2001
> if the month is 12; the year is arbitrary), and convert that back to a month
> name string.
>
> --
>
> John W. Vinson [MVP]
> .
> >> Stay informed about: Number To Month |
|
| Back to top |
|
 |  |
External

Since: Nov 28, 2008 Posts: 104
|
(Msg. 8) Posted: Wed Jan 20, 2010 11:45 pm
Post subject: Re: Number To Month Archived from groups: per prev. post (more info?)
|
|
|
On Wed, 20 Jan 2010 22:20:01 -0800, zyus
wrote:
>Tried in query but still error
>
>SELECT [Tbl-SKS].MONTH, MonthName([month],True) AS Expr1, [expr1]+1 AS Expr2
>FROM [Tbl-SKS];
Well, you can't reuse Expr1 in a later calculation; and if it worked, Expr1
would be the text string "Jan" and "Jan" + 1 will indeed give an error.
Try
SELECT [Tbl-SKS].[MONTH], MonthName([MONTH] MOD 12 + 1, True) AS NextMonth
FROM [Tbl-SKS];
The MOD function calculates the remainder: 3 MOD 12 is just 3, but 12 MOD 12
is 0; this will let you add 1 to December and get January instead of a bogus
thirteenth month. >> Stay informed about: Number To Month |
|
| Back to top |
|
 |  |
External

Since: Jun 21, 2009 Posts: 2
|
(Msg. 9) Posted: Wed Jan 20, 2010 11:58 pm
Post subject: Re: Number To Month Archived from groups: per prev. post (more info?)
|
|
|
If you are actually storing the month name and want to reference the next
months name try this:
Function NextMonth(CurrentMonth)
Select Case CurrentMonth
Case "Jan"
NextMonth = "Feb"
Case "Feb"
NextMonth = "Mar"
Case "Mar"
NextMonth = "Apr"
Case "Apr"
NextMonth = "May"
Case "May"
NextMonth = "Jun"
Case "Jun"
NextMonth = "Jul"
Case "Jul"
NextMonth = "Aug"
Case "Aug"
NextMonth = "Sep"
Case "Sep"
NextMonth = "Oct"
Case "Oct"
NextMonth = "Nov"
Case "Nov"
NextMonth = "Dec"
Case "Dec"
NextMonth = "Jan"
End Select
End Function
Sub TestMonth()
Dim answer As String
answer = NextMonth("Apr")
Debug.Print answer
End Sub
You should though store the actual date involved and then pick out the piece
and display of the date when you query it for reports, et al.
Regards
Kevin
"zyus" wrote in message
> My field [month] consists of month in number.
>
> I've been using this expression to convert number to month name
>
> MonthName([Month],True)
>
> My problem is i want to display one month after ..say Jan from 12/Dec
>
> Hope my explaination is clear >> Stay informed about: Number To Month |
|
| Back to top |
|
 |  |
| Related Topics: | Month-to-date - Hello All, I am working on a safety database and I was asked to make a dashboard that shows all near misses for the month. My question is, is there a way to make the qry calculate the near misses on the current month only? Thanks for all the help.
Show Last Month in TextBox? - Trying to show last monthis a text box "Feburary" =Date()-1"M"
Function for previous month and present year - I am looking for a relatively simple function that will give me the previous month (March) and present year (2009). I know the basic formula to get the present month and year =Format(Date(),"mmmm yyyy") But what do I add to make it give me ...
Number comparison - Good morning, I have 2 tables that I need to compare customer numbers. One table is for customers that the product was sold to. One table is for product returned by customers. The customer number in the sold to table has 8 mumbers with the last 3 ..
convert a number to an autonumber - Hello, I had an old Access database that had a bad design. I exported the data to a csv, cleaned it up, and imported it into a new database. During the import Access wouldn't let me change the field I use as a primary key which was an autonumber.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|