INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

retrive all month> the current month and year

retrive all month> the current month and year

(OP)
I jest have a Date var=set 2015.
Based this var i need to retrive all other month> of set 2015 in the same 2015.

example:var=set 2015
ott 2015
nov 2015
dic 2015

example:var=mar 2015
apr 2015
mag 2015
gu 2015
lug 2015
ago 2015
set 2015
ott 2015
nov 2015
dic 2015

RE: retrive all month> the current month and year

Your "Date var" is not a Date, since it holds 2015 (number?, integer? string?) or 'mar 2015' (string)

How about this, you pass an actual date:

CODE

Option Explicit

Private Sub Command1_Click()

Call MyDates(CDate("05/12/2015"))

End Sub

Private Sub MyDates(ByRef datDate As Date)
Dim intM As Integer

If Month(datDate) = 12 Then Exit Sub

For intM = Month(datDate) + 1 To 12
    MsgBox Format(CDate(intM & "/01/" & Year(datDate)), "mmm yyyy")
Next intM

End Sub 

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

RE: retrive all month> the current month and year

(OP)
as string...

RE: retrive all month> the current month and year

@2009luca, as a programmer, surely you know that dates are not strings. At a minimum, your string ought to lead with year and also use numeric characters for month rather than alpha, which I am certain that you realize as a programmer, that alpha months will not collate as expected.

But I agree with Andy: use actual dates!

RE: retrive all month> the current month and year

So to do what you want, i.e.: "retrive all month[s that are grater than] the current month and year" you may just :

Call MyDates(Date)

Which will give you:
Mar 2015
Apr 2015
May 2015
Jun 2015
Jul 2015
Aug 2015
Sep 2015
Oct 2015
Nov 2015
Dec 2015

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

RE: retrive all month> the current month and year

(OP)
Andrzejek, YES I NEED EXACTLLY WATH YOU POST!

RE: retrive all month> the current month and year

(OP)
RESOLVED Tks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close