473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Import table as query

Hi! I am trying to import a query as a table from a MS
Access database in a specified drive, path, and filename; my filenames
and paths are being stored in a table for easy reconfiguration.
Anybody done this before? Please let me know! Thanks, Sean

BTW: I have learned that if I wanted to import a table, this is how
it's done:
DoCmd.TransferDatabase acImport, "microsoft access",
"C:\Folder\file.mdb", acTable, "sourcetable", "destinationtable"

Nov 13 '05 #1
5 2715
If you would explain what you are trying to accomplish, rather than a
specific way you are trying to do it, someone might be able to offer a
worthwhile suggestion.

For example, I have usually found that linking to an external table, and
doing something other than creating a new table in my database (e.g., an
append query to append new records, or update query) has been better for me
than creating new tables at runtime.

When I do create temporary tables at runtime, I've found it is more
effective to create a temporary database to contain the temporary tables --
that eliminates the deletion of those tables bloating my database; I can
just delete the temporary database file and the temporary tables vanish
along with it.

Larry Linson
Microsoft Access MVP
<st**********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hi! I am trying to import a query as a table from a MS
Access database in a specified drive, path, and filename; my filenames
and paths are being stored in a table for easy reconfiguration.
Anybody done this before? Please let me know! Thanks, Sean

BTW: I have learned that if I wanted to import a table, this is how
it's done:
DoCmd.TransferDatabase acImport, "microsoft access",
"C:\Folder\file.mdb", acTable, "sourcetable", "destinationtable"

Nov 13 '05 #2
Larry:

Thanks for the suggestion. Due to the nature of the situation (numbers
and other data can be updated up to a certain point; beyond that, they
are "written in stone", and updated for their own databases only, not
the one I'm working on, which will then become "historic"), importing
is the way to go, rather than linking. Since the info comes from
multiple tables, I need to import a query as a table -- actually, I
need to do a few of these.

If I could do it another way, I would...
Can you help me with my request? Can anyone? Thanks again,

Sean

Nov 13 '05 #3
Sean,

I just did what you want to do, to refresh my memory on importing tables.

It worked just fine, to obtain a table from an Access 2003 database and
create a new one with the same content but a different name in an Access
2002 database. I used literals in the DoCmd.TransferDatabase, but you can
write code to make it more flexible. What did you need help with,
specifically?

If you execute the DoCmd.TransferDatabase method twice without deleting the
table, the second will create another new table, and append a 1 to the table
name you specify. Thus if you have tblMakeANew, the next one will be
tblMakeANew1, but the DoCmd.TransferDatabase will not fail because of the
existing table.

The path and filename of the source database is a string... it can be stored
in a string variable. That string variable could be populated in a number of
ways... one of which might be DAO (or ADO) code that reads your table -- if
you always want to import every table in the list or if you have criteria
that you can apply to select which tables you want to import; another might
be a ComboBox whose RowSource is a Query that returns the information from
your table and allows the user to select -- your requirements will determine
which would be appropriate.

Clarify what you need and maybe someone can be of help.

Larry Linson
Microsoft Access MVP
<st**********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Larry:

Thanks for the suggestion. Due to the nature of the situation (numbers
and other data can be updated up to a certain point; beyond that, they
are "written in stone", and updated for their own databases only, not
the one I'm working on, which will then become "historic"), importing
is the way to go, rather than linking. Since the info comes from
multiple tables, I need to import a query as a table -- actually, I
need to do a few of these.

If I could do it another way, I would...
Can you help me with my request? Can anyone? Thanks again,

Sean

Nov 13 '05 #4
You bet -- thanks for being willing to help.

I have a table; its fields are filename, filepath, query. I have a
form that lists (in Single Form format) whichever record is selected,
and there is a button on the form which I want to click that will
import that selected query from its specified file and filepath.
(Particularly, I want the query results imported as a table in the
database that's running.) Also, I want to be able to automatically
import several queries as tables; I know that programming that will
come next after I understand how to do it one-at-a-time. All databases
are MS Access 2000.

It seems simple enough -- I'm new to VB, however, and I'm not sure how
to write the lines that will do the importing. I understand defining
strings as variables, and I know the line of code that would import a
specific file. I don't know how to code to specify the value of an
existing record as a string; in other words, how do I say variable1 =
thisrecord of suchandsuch field. Also, I don't know the code for
importing query results as a table; I only know how to import a table.
Thanks,

Sean

Nov 13 '05 #5
You bet -- thanks for being willing to help.

I have a table; its fields are filename, filepath, query. I have a
form that lists (in Single Form format) whichever record is selected,
and there is a button on the form which I want to click that will
import that selected query from its specified file and filepath.
(Particularly, I want the query results imported as a table in the
database that's running.) Also, I want to be able to automatically
import several queries as tables; I know that programming that will
come next after I understand how to do it one-at-a-time. All databases
are MS Access 2000.

It seems simple enough -- I'm new to VB, however, and I'm not sure how
to write the lines that will do the importing. I understand defining
strings as variables, and I know the line of code that would import a
specific file. I don't know how to code to specify the value of an
existing record as a string; in other words, how do I say variable1 =
thisrecord of suchandsuch field. Also, I don't know the code for
importing query results as a table; I only know how to import a table.
Thanks,

Sean

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Fred | last post by:
Hi. How do I import while mapping an excel table to an access table please??? I've searched around and all I can find is a software product or code that does the same thing as the access...
20
by: Steve Jorgensen | last post by:
Hi all, I've just finished almost all of what has turned out to be a real bear of a project. It has to import data from a monthly spreadsheet export from another program, and convert that into...
4
by: Steve Jorgensen | last post by:
I'm restarting this thread with a different focus. The project I'm working on now id coming along and will be made to work, and it's too late to start over with a new strategy. Still, I'm not...
3
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook -...
10
by: shumaker | last post by:
I don't need a detailed description of a solution(although I wouldn't mind), but I am hoping someone could tell me in general the best path to go about accomplishing a task, since I don't know all...
8
by: Nick M | last post by:
Hello All, Excellent info here Thanks! I am very new to using access in general and I am on a learning curve. I'm trying to import an excel workbook (with worksheets) into an access db via a...
11
by: kaisersose1995 | last post by:
Hi, I've got an import procedure working, using a standard import specification to import a .csv file into a temporary table. The problem i'm having is that i have 4 different sets of borrower...
7
by: perryche | last post by:
Is there a way with MS Access 2002 and above to prevent people importing from a blank Database the tables in another database? I have done a lot of searches but there isn't really a solution that...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.