Dim strFileName As String
Dim oDialog As Object
Set oDialog = [Forms]![frmForm1]!xDialog.Object
With oDialog ' Ask for new file location.
.DialogTitle = "Please select a new file"
.Filter = "Access Database(*.mdb)|" & _
"*.mdb"
.FilterIndex = 1
.ShowOpen
' If user responded, put selection into text box on form.
If Len(.FileName) > 0 Then _
[Forms]![frmForm1]![txtFileName] = .FileName
End With