Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Import data for all tables

Geek News

Import data for all tables
Frank Situmorang 12/2/2008 9:37:00 AM
Hello,

If I want to import data from excel/access for consolidation of data, how
can we import all tables at once. I need it because of the following:

In members table there is a forein key for address table primary key. FK in
member is a required field and we need to import all data at once, otherwise
it will be rejected.

Anyone can help me how can we do it?.

Thanks in advance for any help provided.

--
H. Frank Situmorang
RE: Import data for all tables
Dale Fye 12/2/2008 5:05:00 PM
Sorry, Frank, you are out of luck. There is no way to import multiple tables
"all at once".

However, what you need to do is relatively easy, once you do a thorough
review of your database structure. I would create a single proceedure (sub
or function), in put multiple lines of the docmd.Transferspreadsheet.

1. Identify all of your lookup tables (those tables which have a primary
key, but don't contain any foreign keys). Import these tables first.

2. Then identify those tables that only have foreign keys that relate to
the tables imported during step #1, and import them.

3. Lastly, identify the other tables, and import them in sequence, making
sure that all of the tables with PKs that are referenced as FKs have already
been imported.

This last step is generally the most difficult, but unless you have tables
with 5 or 6 FK fields, it should not be too bad. If you step through your
code, and go into debug mode when you encounter an error message, then you
can shuffle the lines of code until it works properly.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



"Frank Situmorang" wrote:

[Quoted Text]
> Hello,
>
> If I want to import data from excel/access for consolidation of data, how
> can we import all tables at once. I need it because of the following:
>
> In members table there is a forein key for address table primary key. FK in
> member is a required field and we need to import all data at once, otherwise
> it will be rejected.
>
> Anyone can help me how can we do it?.
>
> Thanks in advance for any help provided.
>
> --
> H. Frank Situmorang
RE: Import data for all tables
bhammer 12/2/2008 5:07:01 PM
"Frank Situmorang" wrote:

[Quoted Text]
> Hello,
>
> If I want to import data from excel/access for consolidation of data, how
> can we import all tables at once. I need it because of the following:
>
> In members table there is a forein key for address table primary key. FK in
> member is a required field and we need to import all data at once, otherwise
> it will be rejected.
>
> Anyone can help me how can we do it?.
>
> Thanks in advance for any help provided.
>
> --
> H. Frank Situmorang

Why not create one large query with all the fields from all the tables you
want. You may have to experiment with the relationship arrows to get the
desired records to display. Then you can use the built-in Office Link command
on the Access Tools menu to export to Excel.

-Brad
Re: Import data for all tables
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 12/2/2008 5:42:07 PM
Frank Situmorang wrote:
[Quoted Text]
> Hello,
>
> If I want to import data from excel/access for consolidation of data,
> how can we import all tables at once. I need it because of the
> following:
>
> In members table there is a forein key for address table primary key.
> FK in member is a required field and we need to import all data at
> once, otherwise it will be rejected.
>

1. If you are importing then the information should already be in the tables
to be imported. If the foreign key is not there there is no way for anything
but a human to fill it in.
2. Tables are imported in a sequential manner, you can't do them all at the
same time.




Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net