Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 140
  • Last Modified:

How to retrieve the files between two dates through Vb?

How to retrieve the files between two dates through Vb?
This is my code. Its working but the last file was not displaying which was created 03/11/2003.

fileName = "E:\Archive\2\700\708\"
Set mainfile = fso.GetFolder(fileName)
Set filesCollection = mainfile.Files
For Each temp1 In filesCollection
    'MsgBox temp1.name
    fileCreationDate = temp1.DateLastModified
   
    If (fileCreationDate <= #3/25/2002#) and (fileCreationDate >= #3/11/2003#)) then
    MsgBox temp1.name
    'MsgBox temp1.DateLastModified
    End If
Next

Advance thanks.


thanks,
Merlin.
0
merlin_vb1
Asked:
merlin_vb1
1 Solution
 
JH0401Commented:
Try this:

If Format(fileCreationDate,"#") >= Format (#3/25/2002#,"#") and Format(fileCreationDate,"#") <= Format (#3/11/2003#,"#") Then
msgbox temp1.name
end if
0
 
merlin_vb1Author Commented:
Thanks for your help.
Its working fine.

How can i close this Question? plese help me.

thanks,
Merlin
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now