0

I'm working on a mini-project at work:

I need to Import data from SQL server 2008 to Access 2007 so that an end user can access the data/run reports etc.

Things I am not allowed to do:

I am not allowed to link the data [don't want the end user running queries on the SQL server database which is live]

I am not allowed to create a SQL task/SQL job/SSIS package to do this nor am I allowed to write a little application in C#/VB.NET etc.

Things I can do:

I'm only allowed to create an Access form which copies data from the SQL server database to a local Access DB on a button click.

I must store the connection string in an inaccessible place so that the end user cannot see it/edit it

Things I've tried

I've tried to use the "External Data Import" manually and that works just fine but creates a new table every time I run it [Something like MyTable1, MyTable2].

I can't seem to find any sources that concisely describe how I could automate this [save for the button click].

I would like for someone to point me to resources or help me figure this out. I am not looking for someone to write code for me. I just don't know where to start.

10
  • When I said I can't link it, I meant I cannot use linked tables to the SQL server. I can only copy the data to local tables. Commented Apr 30, 2015 at 19:57
  • 1
    Sorry, I misunderstood about the form. Since import external data does what you want, you can accomplish the same thing with DoCmd.TransferDatabase. Delete the old copy of the table first in order to avoid that naming issue. Commented Apr 30, 2015 at 20:18
  • Thank you. Would DoCmd.TransferDatabase work if I need to copy only a subset of tables? Also, how is this different from DoCmd.TransferSQLDatabase Commented Apr 30, 2015 at 20:25
  • 1
    What you mean by copy only a subset of tables? Is that something you were able to accomplish with the import external data option in the Access UI? Commented Apr 30, 2015 at 20:28
  • 1
    Pick one table. Use DoCmd.TransferDatabase to import it into Access. Repeat that process for each of your other tables. Commented Apr 30, 2015 at 20:39

1 Answer 1

2

You might look into using the "TransferDatabase" method. It allows you to import and export data from outside data sources. You could get to a sql server using ODBC. See:

https://msdn.microsoft.com/en-us/library/office/ff196455.aspx

Also, if you don't want users to get easy access to your connection string, you can publish it as an MDE file so they can not see the code. But the connection string isn't encrypted... so it's not unhackable.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.