I need the most recent folder on a drive
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 206   1
URL.หัวข้อ / URL
I need the most recent folder on a drive

ถามไว้ที่ 
http://www.access-programmers.co.uk/forums/showthread.php?s=&postid=115445#post115445 
 
ดังนี้ 
 
I have a drive that have the following folders.  
 
Jan02  
Feb02  
.  
.  
.  
Aug02  
 
A new folder is created manually each month i.e. in October I will create a  
Sep02 folder. What I need to do is grab the folder name of the last folder  
created. I know how to use the dir$ command but I don't know how I can tell if the  
folder name is the most recent one created. Does anyone have any ideas how  
I can do this?  
 
Thanks,  
 
ต้องการหาว่าโฟลเดอร์สร้างขึ้นวันที่เท่าไร เพื่อจะหาโฟลเดอร์ที่สร้างล่าสุด 
 
ผมเลยให้โค้ดเขาไป โดยมี Scripting File System เป็นพระเอกตามเคยครับ 
 
Private Function FolderCreatedDate() 
 
    Dim objFS As Object, objFolder As Object 
    Dim strFolderPath As String 
   
    strFolderPath = "i:\test\" 
    Set objFS = CreateObject("Scripting.FileSystemObject") 
    Set objFolder = objFS.GetFolder(strFolderPath) 
    Debug.Print "Created --> " & objFolder.DateCreated 
    Set objFolder = Nothing 
    Set objFS = Nothing 
     
    
End Function 
 
จากตัวอย่างเป็นการแสดงวันที่สร้างโฟลเดอร์ชื่อ i:\test\ 
 
 

1 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R06569
   
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.0476s