Cutoff date in Visual Basic

Posted on 2009-12-21
Medium Priority
Last Modified: 2012-05-08
I have a form in VB6.  I have a dropdown box that lists all the months.  However, I want a user to be able to ONLY select the current month based on what month it is.  It has be on the 8th of the current month to the 8th of the next month.

So, for example, if they choose the dropdown today they should only be able to select December.  They can select December all the way up until January 8th.  After that day, they can only select January.

Is there a way to do this in VB6?
Question by:al4629740
1 Comment

Accepted Solution

ViaTom earned 2000 total points
ID: 26098966
The way I understand it, you want it to show December for dates between Dec 8 and Jan 7.  Then on Jan 8, it should change to January.

You could try this...

if day(now) < 8 then
    selectMonth = format(dateadd("m", -1, now), "mmmm")
    selectMonth = format(now, "mmmm")

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

862 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