I'm currently importing a sheet from Excel into Access 2003 using Docmd.TransferSpreadsheet.

This works fine but requires the path of the file in question to be stated as one of the parameters. I have done this and it works but, I would like the user to be able to navigate to the file using the standard
open file dialog box.

The Code is

Private Sub Detail_Click()

On Error GoTo Err_Command0_Click
'Declare a variable as a FileDialog object.
Dim fd As FileDialog
Dim vrtSelectedItem As Variant

'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)

'Reference the FileDialog object.
With fd
'Allow the user to select only one file.
.AllowMultiSelect = False
' Show method to display the File Picker dialog box and return the user's action.
'The user pressed the action button.
If .Show = -1 Then
'Step through each string in the FileDialogSelectedItems collection.
For Each vrtSelectedItem In .SelectedItems

LstBx.RowSourceType = "value List"
LstBx.RowSource = vrtSelectedItem

Next vrtSelectedItem

'The user pressed Cancel.
Set fd = Nothing
Exit Sub
End If

End With

' Set form controls
Forms![frmimport]![Text1].Enabled = True
Forms![frmimport]![Command0].Enabled = False

'Set the object variable to Nothing.
Set fd = Nothing

Exit Sub
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Now when i select a file an error is shown "Object Required"

Any help appreciated... [img]/images/graemlins/confused.gif[/img]