Private Sub txtSource_Click()
Dim Dialog As FileDialog
Dim Selected As Long
Set Dialog = FileDialog(msoFileDialogFilePicker)
With Dialog
.AllowMultiSelect = False
.InitialFileName = Nz(Me!txtSource.Value)
.Title = "Select file to copy"
Selected = .Show
If Selected <> 0 Then
Me!txtSource.Value = .SelectedItems.Item(1)
End If
End With
Cancel = True
End Sub
Private Sub txtTarget_Click()
Dim Dialog As FileDialog
Dim Selected As Long
Set Dialog = FileDialog(msoFileDialogSaveAs)
With Dialog
.AllowMultiSelect = False
.InitialFileName = Nz(Me!txtSource.Value)
.Title = "Name saved file"
'.InitialFileName = "N:\"
Selected = .Show
DoCmd.SetWarnings False
If Selected <> 0 Then
Me!txtTarget.Value = .SelectedItems.Item(1)
TargetFile = .SelectedItems.Item(1)
If Not IsNull(Me!txtSource.Value) Then
FileCopy Me!txtSource.Value, Me!txtTarget.Value
Me.txtTarget = Split(TargetFile, ":")(1)
End If
' Application.FollowHyperlink Me.txtTarget
End If
End With
Cancel = True
End Sub
error.png
ASKER
ASKER
ASKER
ASKER
ASKER
ASKER
ASKER
ASKER
ASKER
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY