Need code to import files

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

    #1

    Need code to import files

    Hello,

    I have a directory on my company network that contains multiple
    directories that each hold different files, some are dbf files and some
    are xls files. I need my Access 2000 users to be able to click an
    Import File button on a form and then a list of the multiple
    directories would appear and they could open the particular directory
    they want and double click on whichever dbf or xls they need and it
    would automatically import. I have been looking for some code to do
    this but haven't found exactly what I need. I would appreciate any help
    that can be given.

  • pietlinden@hotmail.com

    #2
    Re: Need code to import files

    umm... Ken Getz's OpenSaveFile API at AccessWeb is your friend.
    Then pass the result to whatever your import routine is...
    Happy coding.

    Comment

    • Smartin

      #3
      Re: Need code to import files

      Farina wrote:[color=blue]
      > Hello,
      >
      > I have a directory on my company network that contains multiple
      > directories that each hold different files, some are dbf files and some
      > are xls files. I need my Access 2000 users to be able to click an
      > Import File button on a form and then a list of the multiple
      > directories would appear and they could open the particular directory
      > they want and double click on whichever dbf or xls they need and it
      > would automatically import. I have been looking for some code to do
      > this but haven't found exactly what I need. I would appreciate any help
      > that can be given.
      >[/color]

      I don't have the solution but I do have a couple questions.

      Is using the built-in Import function out of the question?

      Assuming the answer to the first question is "no", do all the .xls files
      have a layout that can be "automatica lly" imported without any tweaking?
      If you have worked with importing .xls (I have not worked with .dbf)
      you probably know that there are things to consider at import time,
      e.g., which worksheet(s) to import, first row contains column
      headings?, table name to create, which column(s) to index, what to do
      about primary key, etc.

      Just a thought.
      --
      Smartin

      Comment

      • Farina

        #4
        Re: Need code to import files

        Thanks for responding. I had not considered using the built-in Import
        function. A friend mentioned that I needed to use the Dir Function. All
        the .xls and .dbf files will be different, but will only be one
        worksheet and the first row will always be the headings. I would like
        to be able to give the table a name upon import. There is no concern
        about the index so whatever works. There is a company_id that will
        always be used as the primary key.

        Comment

        • pietlinden@hotmail.com

          #5
          Re: Need code to import files

          Your best bet (from the limited information you've given) is probably
          to create an import specification, name it, and then use it in your
          loop that imports all the files. Look around the NG for examples of
          DIR and that should get you going. You essentially throw in a
          TransferSpreads heet command inside the loop, and away you go.

          Comment

          Working...