import file box

  • Thread starter Thread starter Ezra
  • Start date Start date
E

Ezra

I would assume that this should be fairly easy. Maybe I
am wrong. I am trying to build a front end for an
associate that need to import raw text files into a
access. The files are not always named the same so I
figured i would create a from with an update table button
and a box to select/search for the correct file. I would
then have the macro/VB import and format that file and
insert the data into the table. I cannot figure out how
to get the file box to do anything. Any ideas?
Suggestions?

Thank you,
Ezra
 
You can add a Common Dialog control to your form - you'd probably need to add
it to your toolbox.

' Throw error if Cancel
myDialog.CancelError = True
myDialog.DialogTitle = "Search For File To Import"
myDialog.Filter = "All Files (*.*)|*.*"

On Error Resume Next
strFilePath = myDialog.ShowOpen

If Err.Number = 32755 Then ' Cancel

MsgBox "Cancel pressed."
Exit Sub

End If

On Error GoTo 0

' Proceed with import - strFilePath has your path
 
Back
Top