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
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
Comment