Solved

Create a button to automatically import SQL table Access 2007

Posted on 2012-04-13
13
288 Views
Last Modified: 2012-04-16
I found these instructions: First, manually go through the Wizard, and before you get to the last step where you actually import the data, click on the Advanced button and save you Import Specification (give it a name).

Then create a macro to import the data (using the TransferText command). The Help will tell you what it needs in each argument.

Now, if you highlight that macro, you can go to the Tools button and select Macro | Convert Macros to Visual Basic. This will give you the code that you need to place behind your command button to automatically import your files.
My problem in trying to follow them is: The Advanced button never comes up. Also, I really need a way to replace the data in the existing table, rather than create a new one. Some of the things I have read say: If you Choose Create a new table and the table exists, it will overwrite it. I also do not get the choice of create or append.
I only get: Import the source data into a new table in the current database (I am choosing this one)
The other choice is Link to the data source by creating a linked table(Not what I want to do).
Then I choose my data source and import table, It goes straight to All objects imported sucessfully. There is a check box to Save the import steps. I checked it. Entered the save as information. Clicked Save Import.
0
Comment
Question by:qbjgqbjg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
13 Comments
 
LVL 7

Expert Comment

by:karunamoorthy
ID: 37843238
I had an experience of importing test file, dbf file etc into access table. What i did was to create a vb exe file and put it in a windows task scheduler and the table creation and data updation takes place automatically without any user intervention.

If it is possible to share sample text file along with field structure, I can give you the complete coding for you to finish your task.

from
Karunamoorthy
0
 

Author Comment

by:qbjgqbjg
ID: 37843264
I am not a VB programmer. The table I am importing is from SQL database. It cannot be done automatically. It will need for the user to start it, since they have some tasks to complete to get the SQL table "ready".
0
 

Author Comment

by:qbjgqbjg
ID: 37843267
I am also very new to Access.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:qbjgqbjg
ID: 37843297
I am importing using an ODBC connection.
0
 
LVL 7

Expert Comment

by:karunamoorthy
ID: 37843348
then this may help, if you follow it,
pl check out this URL
http://msdn.microsoft.com/en-us/library/bb177406(v=office.12).aspx
0
 

Author Comment

by:qbjgqbjg
ID: 37843388
That information seems to apply just to Text files, not SQL.
0
 

Author Comment

by:qbjgqbjg
ID: 37843429
Are there settings to change that might help me get advanced to show up and to get the import to overwrite the existing table?
0
 

Author Comment

by:qbjgqbjg
ID: 37843535
To solve the overwrite problem, it looks like I need to Delete the existing table, then import the sql table. So, if I can get some code to do those things I will be in good shape.
0
 
LVL 7

Accepted Solution

by:
karunamoorthy earned 500 total points
ID: 37845635
You can delete table data using

DELETE [Table1].* FROM [TABLE1];
0
 
LVL 7

Assisted Solution

by:karunamoorthy
karunamoorthy earned 500 total points
ID: 37845638
0
 
LVL 7

Expert Comment

by:karunamoorthy
ID: 37846134
Hello qbjgqbjg,
Any comments pl
0
 

Author Comment

by:qbjgqbjg
ID: 37851299
Thanks. The delete is helpful. Now the only thing I need is how to do the import using a button.
0
 

Author Closing Comment

by:qbjgqbjg
ID: 37851602
It looks like I have what I need. Thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question