visual basic add 1 month to variable

Posted on 2004-04-21
Last Modified: 2006-11-17
I have a program that I need to have the next month.

meaning if today is 4/12/04

then the month is april

I need it to be may

so whatever the current month is it has to end up as May and has to be spelled out like this not 5

any ideas

this is vb6

Question by:hogan9111
  • 2

Expert Comment

ID: 10882015
You could use DateAdd() to add one month, and MonthName() to turn the number into a name.
LVL 20

Accepted Solution

hes earned 25 total points
ID: 10882078
Try this

Dim MDate As String
MDate = "04/12/04"
MDate = DateAdd("m", 1, MDate)
MDate = Format(MDate, "m")
MDate = MonthName(MDate)

Author Comment

ID: 10882854
beautiful, thanks
LVL 20

Expert Comment

ID: 10883179
Your Welcome, glad to be able to have helped.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now