Djackola
Technical User
- Jan 31, 2011
- 7
I have a database with 5000 client records
I setup a button in my form to create a folder for a client using the first name,Surname and Id fields in specific location ( Source folder) and other one to view the created folder. ( both codes listed below).
I'm writing letters to those clients using word application and my problem when I want to save the word file in a the client folder it take long time to find the client folder.
Is any way to setup a code to let me to lunch a word document in a client folder and to be saved there automatically.(eg. Click the create document button and it will create a word document in that directory) not in a specific location .
regards
Moawia
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
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:\mainData\" & 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
I setup a button in my form to create a folder for a client using the first name,Surname and Id fields in specific location ( Source folder) and other one to view the created folder. ( both codes listed below).
I'm writing letters to those clients using word application and my problem when I want to save the word file in a the client folder it take long time to find the client folder.
Is any way to setup a code to let me to lunch a word document in a client folder and to be saved there automatically.(eg. Click the create document button and it will create a word document in that directory) not in a specific location .
regards
Moawia
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
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:\mainData\" & 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