Hi Guys, i have a command button that will add Date folders to a specific loaction, i was wondering if I can replace these folders with new one's once that date has expired, these folders are named With DayName Day/Month/Year, the date is taken from a text box (txtDate) ie:
Dim FldPath as String
Dim FldWed as String
Dim FldSun As String
FldPath = "T:\folderA\FolderB"
FldWed = FldPath & Format(Me.txtDate,"ddd-dd-mm-yyyy") ' CAN THIS BE AUTO NEXT AVAILABLE WEDNESDAY AND NOT USE TEXT BOX DATE ??
FldSun = FldPath & Format(Me.txtDate,"ddd-dd-mm-yyyy") ' CAN THIS BE AUTO NEXT AVAILABLE SUNDAY AND NOT USE TEXT BOX DATE ??
If Dir(FldPath & FldWed, vbDirectory) <>"" Then
DoCmd.CancelEvent
Else
MkDir(FldPath & FldWed)
End IF
If Dir(FldPath & FldSun, vbDirectory) <>"" Then
DoCmd.CancelEvent
Else
MkDir(FldPath & FldSun)
End IF
Let's Say FldWed = Wed-06-06-2018
Once Todays Date becomes the 7th June 2018
I know there is RmDir Function to remove folder and files, is there a way of Coding this to pop up a msgbox something like:
You Have got a folder dated (FldWed), As it is now Thursday 7th, Do you want to remove this folder and contents and add a new Wednesday Folder for next week ?
If Yes, Find next Wednesday's date
MkDir (next Wednesdays date)
RmDir Yesterdays Date
Many thanks
Dave