Can anyone tell me what is wrong with this code?
Dim current_date As String Dim filename As String Private Sub Form_Load() Dim path As String current_date = DateValue(Now) current_date = Format(DateValue(Now), "YYYYMMDD") Debug.Print current_date filename = "Daily SMS Backup " & current_date & " 200.sql" Debug.Print filename path = "P:\" Shell ("cmd.exe /c del " & path & "filename") End Sub
P:\ is a mapped network drive on the server.
What this code should do is
get the current date of the form YYYYMMDD. Ok
create a strng of the file I want to delete. Ok
Execute a shell to browse to P:\
and delete the file filename. This is where it goes wrong for me.
Can anyone help me please