Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it end of the month?

Status
Not open for further replies.

madhouse

Programmer
Sep 17, 2002
165
GB
I have an Access database with a form to select a "log file" to be imported. The log files are always named in the format TmRsLogDATE.csv where DATE is the date of the log file e.g. TmRsLog2003-02-28.csv. Is it possible to work out from the filename if the log file to be imported is an end of month file? I am able to strip out and format the date from the filename with no problem using the follwing code:

strSearch = "TmRsLog"
strLogDate = Mid(Me.txtFilePath, InStr(Me.txtFilePath, strSearch) + 7, 10)
strLogDate = FormatDateTime(strLogDate, vbShortDate)

So in the above example I would end up with the date 28/02/03. However, I don't know how I can then check to see if the date is the end of that month? PLEASE NOTE, the log file being imported may not be within the current month, so when checking to see if the date of the log file is the end of the month it cannot be checked against the current month - it has to be checked against the month in the log filename!!

Any help would be appreciated.
 
hmm, let's see what i can come up with here...

Please keep in mind that i'm not in a position right now to test, so this is off the top of my head...(hope none of my hair get's in it for ya:))

If strLogDate = DateSerial(DatePart("yyyy", strLogDate), DatePart("m", strLogDate) + 1, 0) Then
MsgBox "End of month."
Else
MsgBox "Not end of month."
End If

Hope this helps.

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top