I have the following question:
I have created two working buttons: button 278 and button 282
in my access form
--------------------------------------------
button 278 = to open an existing .txt document and if not exists, create one
Private Sub Command278_Click()
On Error GoTo Err_Knop278_Click
Dim shlApp As String
Dim stDocName As String
Dim stnaamfile As String
stDocName = "bezoekrapport"
stnaamfile = Me.ACHTERNAAM & " " & Me.VOORNAAM
Dim LResult As String
LResult = LCase("stnaamfile")
shlApp = "notepad.exe c:\Users\eigenaar\Documents\BEHEER\beheerklantenmappen" & stnaamfile & "" & stDocName & ".txt"
Call Shell(shlApp, vbMaximizedFocus)
Exit_Knop278_Click:
Exit Sub
Err_Knop278_Click:
MsgBox Err.Description
Resume Exit_Knop278_Click
End Sub
--------------------------------------------------------
button 282 = button to open a folder (containing all the clients documents)
and if not exists create one
Private Sub Command282_Click()
On Error GoTo Err_Knop282_Click
Dim Foldername As String
Dim stnaamfile As String
stnaamfile = Me.ACHTERNAAM & " " & Me.VOORNAAM
Dim LResult As String
LResult = LCase("stnaamfile")
Foldername = "c:\Users\eigenaar\Documents\BEHEER\beheerklantenmappen" & stnaamfile
On Error Resume Next
MkDir Foldername
Shell "C:\Windows\explorer.exe """ & Foldername & "", vbNormalFocus
On Error GoTo 0
Exit_Knop282_Click:
Exit Sub
Err_Knop282_Click:
MsgBox Err.Description
Resume Exit_Knop282_Click
End Sub
----------
Both buttons are working fine and do wath I want them to do.
But I would like the button 278 to do one thing more. And that is:
If nor the folder nor the text file exist, it should first create
the new folder and afterwards the new text file.
(this is because my colleague also uses the program, and I don't want him to think to much....)
Is this possible?
I have created two working buttons: button 278 and button 282
in my access form
--------------------------------------------
button 278 = to open an existing .txt document and if not exists, create one
Private Sub Command278_Click()
On Error GoTo Err_Knop278_Click
Dim shlApp As String
Dim stDocName As String
Dim stnaamfile As String
stDocName = "bezoekrapport"
stnaamfile = Me.ACHTERNAAM & " " & Me.VOORNAAM
Dim LResult As String
LResult = LCase("stnaamfile")
shlApp = "notepad.exe c:\Users\eigenaar\Documents\BEHEER\beheerklantenmappen" & stnaamfile & "" & stDocName & ".txt"
Call Shell(shlApp, vbMaximizedFocus)
Exit_Knop278_Click:
Exit Sub
Err_Knop278_Click:
MsgBox Err.Description
Resume Exit_Knop278_Click
End Sub
--------------------------------------------------------
button 282 = button to open a folder (containing all the clients documents)
and if not exists create one
Private Sub Command282_Click()
On Error GoTo Err_Knop282_Click
Dim Foldername As String
Dim stnaamfile As String
stnaamfile = Me.ACHTERNAAM & " " & Me.VOORNAAM
Dim LResult As String
LResult = LCase("stnaamfile")
Foldername = "c:\Users\eigenaar\Documents\BEHEER\beheerklantenmappen" & stnaamfile
On Error Resume Next
MkDir Foldername
Shell "C:\Windows\explorer.exe """ & Foldername & "", vbNormalFocus
On Error GoTo 0
Exit_Knop282_Click:
Exit Sub
Err_Knop282_Click:
MsgBox Err.Description
Resume Exit_Knop282_Click
End Sub
----------
Both buttons are working fine and do wath I want them to do.
But I would like the button 278 to do one thing more. And that is:
If nor the folder nor the text file exist, it should first create
the new folder and afterwards the new text file.
(this is because my colleague also uses the program, and I don't want him to think to much....)
Is this possible?