IMPORTING ... I want it more user friendly !

Alvis

Learning is fun !
Local time
Yesterday, 16:38
Joined
Feb 13, 2013
Messages
27
Dear Friends ...

Currently, I'm using Import through macro "transferdatabase" and giving the file name and location.

Is it possible to Import a excel spreadsheet through a user friendly file pick option ?

If possible, Any has a sample database for that ?

Below code did till picking the file .. but couldn't import it ...


Private Sub Command2_Click()
Dim dialog As FileDialog
Set dialog = Application.FileDialog(msoFileDialogFilePicker)
With dialog
.AllowMultiSelect = False
.Show
Me.Text0 = .SelectedItems.Item(1)
End With
End Sub
Please support.

Thanks
Alvis
 
Just use the Docmd.TransferDatabase function. Use the code you have posted to get the full path to the database and use that value as the source argument

Code:
Private Sub Command2_Click()
Dim dialog As FileDialog
Set dialog = Application.FileDialog(msoFileDialogFilePicker)
With dialog
    .AllowMultiSelect = False
    .Show
    DoCmd.TransferDatabase acImport, , .SelectedItems.Item(1)
End With
End Sub
 
Thanks .. I'll try it !
 

Users who are viewing this thread

Back
Top Bottom