Hello everyone. I am new here looking for help to my situation:
I need a button which will be placed inside the detail section. It will create or open (if it was already created) an excel file.
I already have a button that creates (or opens) a folder for every customer. In that folder I keep his files and this excel file.The name of the folder is taken from the first field (reference number) and it's unique.
Here is another idea that will work too:
I will have an excel file in a folder when when I click on the button it will copy that file to the specific folder that was created with the below (folder creation/opening) button.
Is this code easier?
Here is the code of the folder button to help you.
Private Sub command81_Click()
Const FOLDER_EXISTS = 75
Dim strFolderPath As String
strFolderPath = "c:\data files\praktor" & Me.[AA]
On Error Resume Next
MkDir "c:\data files\praktor"
Err.Clear
MkDir "c:\data files\praktor"
Err.Clear
MkDir strFolderPath
Select Case Err.Number
Case 0
' no error
Case FOLDER_EXISTS
' folder exists so open it
Application.FollowHyperlink strFolderPath
Case Else
' unknown error so inform user
MsgBox Err.Description, vbExclamation, "Error"
End Select
End Sub
Thank you
[/COLOR]