Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing/Replacing data from external database 1

Status
Not open for further replies.

drichter12

Technical User
Dec 15, 2005
232
US
I have a database in Access 07 that I need to be portable/self-contained, however, it pulls a major peice of data from a database on our internal network as well as other data from linked Excel spreadsheets. My question is, is there an easy way to set my database up so that I can pull the data from the database into a table as needed (the data just needs to be refreshed about once a week or so) replacing the old data with the new? I would also like to do the same with the linked Excel spreadsheets. This would give me the ability to use my database as a stand-alone unit without having to be connected to the internal network or constantly copying updated spreadsheets.

Thanks,

Dale
 
Apparently you want to keep local copies of linked tables/spreadsheets. This can be done by using append, delete, and/or make table queries.

The issue you may have is your forms, reports, and queries all expect tables with specific names. Your "local" copy have different names. You will need to contend with this issue by using code or queries or whatever. Let us know if you need a strategy recommendation for this.

Duane
Hook'D on Access
MS Access MVP
 
The most important peice of data is a site "Master" database on a sequal server. I just set up an ODBC Data link to it on my pc so the table and fields in my access database have the same names as the original. The spreadsheet fields all match in the linked tables as well. I can re-build queries and relationships if I have to in order to make things work better if need be. My biggest stumbling block will just be setting things up so I can run some sort of "Refresh" macro to update all the tables in my database with the external information. I have no problem wiping the data from the tables and just importing the most recent data from the external sources back into them. There are less than 10,000 site records so it should not take long to import data from scratch once a week.



Dale
 
You can write code that runs your delete and append queries like:

Code:
   Dim strQueryName as String
   strQueryName = "qdelTable1"
   Currentdb.Execute strQueryName, dbFailOnError
   strQueryName = "qappTable1"
   Currentdb.Execute strQueryName, dbFailOnError
   strQueryName = "qdelTable2"
   Currentdb.Execute strQueryName, dbFailOnError
   strQueryName = "qappTable2"
   Currentdb.Execute strQueryName, dbFailOnError
   Msgbox "Finished"
You could create a button on a form to run this code.

Duane
Hook'D on Access
MS Access MVP
 
It appears all is working as advertised! Thanks Duane!

Dale
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top