Importing data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SarahK

    Importing data

    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.Visibl e=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.Fil eDialog(3)
    .AllowMultiSele ct = False
    If .Show = True Then
    lblEdit.Visible = True 'runtime error 424: object required
    txtLocalDir = Left$(.Selected Items(1),
    InStrRev(.Selec tedItems(1), "\"))
    txtLocalFileNam e = Right$(.Selecte dItems(1),
    Len(.SelectedIt ems(1)) - InStrRev(.Selec tedItems(1), "\"))
    txtLocalFileNam e.SetFocus
    End If
    End With

    Thanks!
    Sarah

  • pietlinden@hotmail.com

    #2
    Re: Importing data


    SarahK wrote:
    If .Show = True Then
    lblEdit.Visible = True 'runtime error 424: object required
    txtLocalDir = Left$(.Selected Items(1),
    InStrRev(.Selec tedItems(1), "\"))
    txtLocalFileNam e = Right$(.Selecte dItems(1),
    Len(.SelectedIt ems(1)) - InStrRev(.Selec tedItems(1), "\"))
    txtLocalFileNam e.SetFocus
    End If
    End With
    >
    Thanks!
    Sarah
    Do you have a label named "lblEdit" on the form you're calling this
    from? Sounds like you're trying to manipulate an object that doesn't
    exist.

    Comment

    Working...