If I run this...
For i = -1 To -12 Step -1
Debug.Print CStr(Month(Date Add("m", i, Now))) & "/";
CStr(Year(DateA dd("m", i, Now)))
Next i
I get this...
5/2005
4/2005
3/2005
2/2005
1/2005
12/2004
11/2004
10/2004
9/2004
8/2004
7/2004
6/2004
which is exactly what I want, except for one thing -
I would like to see month abbrev replace the numbers.
So, I run this...
For i = -1 To -12 Step -1
Debug.Print Format(Month(Da teAdd("m", i, Now)), "mmm") & "/";
CStr(Year(DateA dd("m", i, Now)))
Next i
But, unfortunately, it returns this...
Jan/2005
Jan/2005
Jan/2005
Jan/2005
Dec/2005
Jan/2004
Jan/2004
Jan/2004
Jan/2004
Jan/2004
Jan/2004
Jan/2004
Am I missing something here? 2 1227
"MLH" <CR**@NorthStat e.net> wrote in message
news:di******** *************** *********@4ax.c om...
[snip] I would like to see month abbrev replace the numbers. So, I run this...
For i = -1 To -12 Step -1 Debug.Print Format(Month(Da teAdd("m", i, Now)), "mmm") & "/"; CStr(Year(DateA dd("m", i, Now))) Next i
But, unfortunately, it returns this... Jan/2005 Jan/2005 Jan/2005 Jan/2005 Dec/2005 Jan/2004 Jan/2004 Jan/2004 Jan/2004 Jan/2004 Jan/2004 Jan/2004
Am I missing something here?
Yes, the expression...
Format(Month(Da teAdd("m", i, Now)), "mmm")
....is incorrect because to format something as "mmm" you must provide a first
argument that is a date and the Month() function returns an integer. Since
dates are actually Doubles under the covers you are actually asking to format a
date that occurs in the first 12 days of the year 1900. Just remove the Month()
function from your expression and it should work.
Actually all you need is...
Format(DateAdd( "m", i, Now), "mmm/yyyy")
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Many thx, Rick. That was certainly my problem. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bas de Laat |
last post by:
I'm trying to fix a running (12 month rolling) sum on a large table
(over 50.000) record. I found already several good advices. First I
Tried it with an Subquery But for large tables it takes to long (see
below version1), then I found a solution with Dsum (see below
version2) It gives the same good result and is faster but in a more
complex variant(below version3) where I add an addition text field
(i.c. Field ) I get no sum at all or all...
|
by: turtle |
last post by:
I need my running sum to work for more than one year. It works great
but then starts over when the year starts over. My example here is
straight from the Northwind database. I want a runningg sum of the
freight but for some reason it does a running sum for each year.
Anybody know how I can get it to keep running no matter the year.
thanks!
SELECT DatePart("yyyy",) AS ayear, DatePart("m",)
AS amonth, Sum(Orders.Freight) AS...
|
by: Trygve Lorentzen |
last post by:
Hi,
my webservice is running on Win2000 SP4, IIS 5.0 fully patched, connecting
to a MySQL database and mainly returning Typed DataSet's from webmethods.
After running for a while, generally a few days, the webservice stops
responding and the .NET windows app client fails with no informative error
message. When I try to run any webmethod from the webservice locally in the
browser I first get a "This page cannot be display IE error...
|
by: TS |
last post by:
Hi, i have inherited a page from another user. The page is the target frame
in a frameset. for some reason the whole page runs twice (page_load, init,
etc. all run twice)
I can't figure out how this is happening. there are no transfers or
redirects that are occurring in the pages. the page runs thru all of its
events then starts all over again. Trying to inspect the stack track doesn't
help because when i get to the init the 2nd time,...
|
by: rajesh |
last post by:
var fixedX = -1 // x position (-1 if to appear below control)
var fixedY = -1 // y position (-1 if to appear below control)
var startAt = 0 // 0 - sunday ; 1 - monday
var showWeekNumber = 0 // 0 - don't show; 1 - show
var showToday = 1 // 0 - don't show; 1 - show
var imgDir = "images/" // directory for images ... e.g. var
imgDir="/img/"
var gotoString = "Go To Current Month"
var todayString = "Today is"
var weekString = "Wk"
| |
by: ship |
last post by:
Hi
How do we open up an MS Access ".mdb" file (from Office 2000 format I
think),
WITHOUT the macros running?!
Our MS Access guy is on holiday for 2 weeks.
Most of the office is on Office 2003 but for historical reason I
believe
|
by: PlayQ |
last post by:
I am using the WMEncoder (seris 9) object inside a .net(c#) encoding app that encodes a wave file to a wma file. Everytime I create and use the WMEncoder object it leak system handles even after I try to release it via GC. If I let my app running continuously it will eventually crash because it runs out of system resources. My code sample is below. I am following the examples in the SDK.
Please help.
Thanks.
Russell Bonakdar
public...
|
by: Vikas |
last post by:
Hi all,
I am working on a document control database where I have a table
"tblControl" containing two columns "DocID" and "SchIssueDate".
"DocID" is the key field with text format while "SchIssueDate" is Date
format.
I am trying to create a S-Curve for the documents to be issued each
month to show the required progress. I have made this query for this:
SELECT Format(,"mmm-yyyy") AS ,
|
by: Phil Stanton |
last post by:
I have a number of queries which use code for the output of 1 or more
fields. For example
Address:GetAddress(AddressID, True, 60)
Address ID Points to an Address in a table - Address Line1, Line 2, Line 3,
Town, County, Post Code, Country.
The True is whether to include the country and the 60 is the maximum line
length (after which a line feed is inserted). All this is to output to a
formatted RTF file for a handbook.
In addition, I...
|
by: JJM0926 |
last post by:
I'm trying to create a running totals query in access 97. I have
followed the directions on how to do it from Microsofts website
article id 138911. I took their code they had and replaced it with my
fields. When I try to run it I get #errors in my RunTot column. I'm
kinda new to this. Not sure if maybe I mistyped something wrong or is
there a better way to do this? I have pasted the code. Any help would
be greatly appreciated....
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |