Tech Support Forum banner
Status
Not open for further replies.
1 - 2 of 2 Posts

·
Registered
Joined
·
1 Posts
Discussion Starter · #1 ·
Hi
I have a database with 150 record. I have a form and inside the form o created 2 buttons , one to Create folder and the other button to view the created folder.I set up the code that to creat the folder for every client using the first name field and Surename field and the ID number in spicific location . eg if i have client name is John Murphy and his ID is 255 , so the created folder will be JOHN Murphy_255Now i want to add a third button in my form to creat for me a Word Document usingn the path Firstname Surname_ID_00 and the second on will be Firstname surname_ID_01
here the codes that im using to create and view folders:

Create folder code
Private Sub CreateFolder_Click()
Dim strname As String
Dim strfname As String

On Error GoTo 1
strname = MemberName
strfname = MemberFamilyName
MkDir "C:\Users\Moawia\Desktop\sOURCE\" & strname & " " & strfname & "__" & ID
MsgBox (strname & " " & strfname & "__" & ID & " has been created successfully")
Exit Sub
1 MsgBox ("Could not create folder for this Client " & vbNewLine & "Folder may created already or " & vbNewLine & "Please check the Client's name and Client's family name.")
End Sub


View Folder Code
Private Sub ViewFolder_Click()
Dim strname As String
Dim strfname As String
Dim path As String


On Error GoTo 1
strname = MemberName
strfname = MemberFamilyName
path = "Explorer.exe C:\Users\Moawia\Desktop\sOURCE\"
folder = strname & " " & strfname & "__" & ID
filename = path & strname & " " & strfname & "__" & ID

If Dir("C:\Users\Moawia\Desktop\sOURCE\" & folder, vbDirectory) <> "" Then
Shell (filename), vbMaximizedFocus

Else
MsgBox ("Folder not exist")
End If
Exit Sub
1 MsgBox ("Could not view folder for this Client, folder may not exist.")
End Sub



Appreciate your help in advance
 
1 - 2 of 2 Posts
Status
Not open for further replies.
Top