Can I put a password into my VBA code when Importing a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MattFitzgerald
    New Member
    • Jul 2007
    • 30

    Can I put a password into my VBA code when Importing a table

    I am using the below code to import a table when the code run I get a pop up box asking me for the password for the database I am importing from.

    Is it possible to put the password into my code so I do not receive the password prompt?

    Code:
    DoCmd.TransferDatabase acImport, "Microsoft Access", "C:\Documents and Settings\fitzgem4\Desktop\2008_2009 V5.mdb", acTable, "Tbl_VOL_References", "Tbl_VOL_References_StratfordData", False
    I have been trying to figure this out for about 2 hours so any help would be very much appreciated, Matt Fitzgerald.
  • cori25
    New Member
    • Oct 2007
    • 83

    #2
    Did you try just linking the table into access.....

    Comment

    • MattFitzgerald
      New Member
      • Jul 2007
      • 30

      #3
      Originally posted by cori25
      Did you try just linking the table into access.....
      To be honest I had not realy given linking the tables any consideration as I am not certain how that works.

      I am pulling data from 2 databases as we have 2 sites and the data from the other location is downloaded by broadband link and the database I am importing to is for running reports so my thoughts are each time I run a report with linked tables I am going to have to wait while the data is refreshed from the remote site.

      Your suggestion has made me consider linking the tables. This is possibly a good idea as I could run a make table query off the linked tables and run my reports and queries off the new tables which would mean I would not be refreshing the data every time.

      This is all based on my assumptions on how I think linked tables work, please can someone correct me if I am wrong or let me know if there is a more optimum soloution?

      Thank you, Matt Fitzgerald

      Comment

      • cori25
        New Member
        • Oct 2007
        • 83

        #4
        Your assumptions about linking tables are correct. I feel this would be the best approach for you.

        In regards to the data refreshing...

        I save the data as a table

        I create a macro to which runs a delete query to clear the table and then a Transfer Spreadsheet to import data from the specified location to the table.

        I run this everytime I run my report so that the table that I run my queries off of is refreshed.

        You can also do it the way you stated.

        I think this would be your best approach.
        Thanks

        Comment

        • MattFitzgerald
          New Member
          • Jul 2007
          • 30

          #5
          Thankyou for all your help

          Comment

          Working...