Importing data

Giganews Newsgroups
Subject: Importing data
Posted by:  SarahK (sarahki…
Date: 2 Aug 2006

Hello all,

I'm brand new to using VBA in Access. I've used it to automate Project,
Excel, and Outlook, but I know that Access is quite different. I've got
the following code (from google group), but when I run it, it allows me
to select the file to import, but then errors out at the line
"lblEdit.Visible=True". I need to be able to select the import file
(which will always be in the same directory folder, but will have a
different filename), and I want it to import to a table called
"tblStaging" that will be deleted at the end of some data validation.
What do I need to do to this code to get there?

'1 = DialogOpen, 2= SaveAs, 3=FilePicker, 4 = FolderPicker
    With Application.FileDialog(3)
    .AllowMultiSelect = False
        If .Show = True Then
        lblEdit.Visible = True 'runtime error 424: object required
        txtLocalDir = Left$(.SelectedItems(1),
InStrRev(.SelectedItems(1), "\"))
        txtLocalFileName = Right$(.SelectedItems(1),
Len(.SelectedItems(1)) - InStrRev(.SelectedItems(1), "\"))
        End If
    End With