al4629740
asked on
date statement in vb6 by month and day only. Not year
Every year, I need to process certain code before April 8 and after January1. How can I do that using the code below?
SelectMonth = Format(currentServerTime, "mmmm")
SelectDay = Format(currentServerTime, "dd")
If (SelectMonth < "April" And SelectMonth < 9) And (SelectMonth < "January" And SelectMonth > 1) Then
'add code here
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you want to do it before April 8 (in other words not "on or before" April 8) then change the "09" to "08".
ASKER
This isn't working
esql = "select GetDate()"
rec.Open (esql), conn, adOpenStatic, adLockReadOnly
currentServerTime = rec.Fields(0)
rec.Close
SelectMonth = Format(currentServerTime, "mmmm")
SelectDay = Format(currentServerTime, "dd")
If (SelectMonth < "April" And SelectDay < "09") And (SelectMonth > "January" And SelectDay > "01") Then
Combo1.AddItem "January,February,March"
End If
ASKER
This doesn't seem to work either
If currentServerTime < "04/09/14" And currentServerTime > "01/01/14" Then
Combo1.AddItem "January,February,March"
End If
What am I doing wrong?
If currentServerTime < "04/09/14" And currentServerTime > "01/01/14" Then
Combo1.AddItem "January,February,March"
End If
What am I doing wrong?
ASKER
Ah. It was a formatting issue.
Thanks
Thanks
You're welcome and I'm glad I was able to help.
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013
In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013