Share via

Help Please - TransferSpreadsheet

Anonymous
2014-09-12T18:56:19+00:00

Hi all:

Can on you Access gurus answer a quick question for me.

I have a database that is split between a front end (PoolFE) and a back end (PoolBE).  I have a form in the front end that I am trying to create some code on to import an Excel spreadsheet as an Access table.  I would like to import it into the back end database.  I have used TranferSperadSheet to import spreadsheets into the front end of databases but never the back end.  Can TransferSpreadSheet be used to import into a back end database or is it a case it only works for the current or open database?  If it can be done what would the code look like?

Any and all help is greatly appreciated.

Thanks.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2014-09-13T22:30:41+00:00

    Too lazy to test, but DoCmd is a method of the Application object, so you might be able to instantiate an instance of the Access Application, use its OpenCurrentDatabase method to point to the back-end and go from there.

    Something like:

    Dim app As Object

      Set app = CreateObject("Access.Application")

      app.OpenCurrentDatabase "\SomeServer\SomeShare\SomeFolder\SomeFile.accdb"

      app.DoCmd.TransferSpreadsheet ....

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2014-09-15T15:10:14+00:00

    If all you need to be able to do is read the data then linking to the Excel worksheet makes more sense than importing.  If you need to be able to edit the data in Access then also create a table in the back end and, to keep it up-to-date (a) delete all rows from it by means of Delete query and (b) refill it by means of an Append query based on the linked Excel table.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2014-09-15T14:21:03+00:00

    Doug:

    Thanks for the help.  Seeing your and Ken's answers I am wondering if I am making this harder than it has to be.  My goal was trying not to have any table saved as part of the front end database.  Where this Excel file is coming from a source outside of our company and is being updated at least once a day I am now thinking maybe what I should just do is set up a "link " to the file in my front end and  be done with it.

    Does this make sense?

    Thanks,

    Darren

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-09-15T14:13:13+00:00

    Ken:

    Thanks for the help.

    Darren

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2014-09-13T18:15:17+00:00

    As far as I'm aware the TransferSpreadSheet method can only refer to the current database.  However, you could try creating a Public function in the back end file which calls the method.  Then create a reference to the back end file (Tools | References on the VBA menu bar).  This will expose the function in the front end, so you can then call it there to, hopefully, import the spreadsheet into the back end.  I've never tried it, but see no reason why it shouldn't work.

    Was this answer helpful?

    0 comments No comments