Code:
'Code behind the button
'-----------------
' Grab a copy of the Office file dialog
With Application.FileDialog(msoFileDialogFolderPicker)
' Set the dialog title
.Title = "Locate a folder to export"
' Set the button caption
.ButtonName = "Choose"
.InitialFileName = "C:\"
' Show files as thumbnails
.InitialView = msoFileDialogViewThumbnail
' Show the dialog and test the return
If .Show = 0 Then
' Didn't pick a file - bail
Exit Sub
End If
' Should be only one filename - grab it
strPath = Trim(.SelectedItems(1))
End With
' Put focus in a safe place
'----------------------------
Me.SaveSelected.Enabled = False
'----------------------------------
Me.SetFocus
Thanks ItsMe thank you so much. I searched google with different phrasing but there is no match. But your solution is so simple. Here is how I applied your solution
Code:
'Code on timer event of form
-=======================
'=====================================
If Me.SaveSelected.Enabled = True Then
Exit Sub
Else
'----------------------------------
If strPath = "" Then
MsgBox "Please pick a folder to export to."
Me.AddFile.SetFocus
Exit Sub
End If
If Me.Dirty = True Then Me.Dirty = False 'Save the record
Dim rstCurrent As DAO.Recordset
Set rstCurrent = Me.RecordsetClone
'Make sure there is a record
If rstCurrent.RecordCount < 0 Then
MsgBox "Please add a new record by typing text into the field provided."
rstCurrent.Close
Set rstCurrent = Nothing
Exit Sub
End If
rstCurrent.FindFirst "ID = " & Me.ID
Call SaveAttachments(rstCurrent, "Files", strPath & "\")
'rstCurrent.Edit
'Call RemoveAttachment(rstCurrent, "FileAttach", "Test.txt") 'Use to delete the attachment from the field
'rstCurrent.Update
rstCurrent.Close
Set rstCurrent = Nothing
MsgBox "The folowing path was used... " & vbCrLf & strPath
'---------------------------------------------
Me.SaveSelected.Enabled = True
End If
Thanks All of you