Compare on date

jgier

Registered User.
Local time
Today, 15:30
Joined
Mar 19, 2012
Messages
21
Hello,

I'm stuck on I would think a fairly simple compare. I'm trying to create an If Then statement that will compare a date. I was hoping that this would work...

Dim strFileDate as string
Dim strFileDate2 as string

strFileDate = Format(Date, "YYYYMMDD")
strFileDate2 = Format(Date, "2012MMDD")

If strFileDate = strFileDate2 then 'place into whatever designated folder according to the year

Now I know that theres something wrong with the strFileDate2. Anyone have advice or another way to do this?
 
What exactly are you wanting to do?

Change/store/do something based on Year?
Can you give a concrete example?
 
I'm trying to open various databases up based upon current year for a link table process. So If Current Date equals 2012 Then open database for 2012. My process works if I'm not specifying a year but I need to automate it so I'm not updating the code every year.

I just had a thought, am I using the wrong formatting type to do a compare by year?
 
You are the man jdraw haha. Thanks that worked really well.
 

Users who are viewing this thread

Back
Top Bottom