dynamic string connection

dynamic string connection

am 01.12.2007 01:59:22 von MrCedars

Hi,

I am new to using Microsoft Acces, I know I need to use some VBA code
to do this job. Not sure where to start is someone could put me in the
right direction. Any help would be appreciated.

I have a connection string I need to use to import data into a single
table and by doing a sql query, i have 1000's of files i need to loop
through and import all the ino into one single table all files are
laid out exactly the same, same structure and field, table names etc.
I want to be able to grab a list of folders in c:\data\ it contains
1000's of folders ie 999 each folder has a folder called data inside
of it is the small database files, i need to get a listing of all the
folders so i can concatenate with connection string that i can loop
through all of them, get the data I need and import into one single
table in Access over and over.

My connection string is "ODBC;DRIVER={GTA ODBC for DATA};DBB=c:\data
\999\data\database.dat" and my sql statement:

select

*

from

PARTS

where

cust=899

So i need to import this data over and over again until I get every
single folder 1-1000... into one single table.

I hope someone can send me in the right direction.

Thanks

Re: dynamic string connection

am 01.12.2007 19:31:46 von Salad

MrCedars wrote:

> Hi,
>
> I am new to using Microsoft Acces, I know I need to use some VBA code
> to do this job. Not sure where to start is someone could put me in the
> right direction. Any help would be appreciated.
>
> I have a connection string I need to use to import data into a single
> table and by doing a sql query, i have 1000's of files i need to loop
> through and import all the ino into one single table all files are
> laid out exactly the same, same structure and field, table names etc.
> I want to be able to grab a list of folders in c:\data\ it contains
> 1000's of folders ie 999 each folder has a folder called data inside
> of it is the small database files, i need to get a listing of all the
> folders so i can concatenate with connection string that i can loop
> through all of them, get the data I need and import into one single
> table in Access over and over.
>
> My connection string is "ODBC;DRIVER={GTA ODBC for DATA};DBB=c:\data
> \999\data\database.dat" and my sql statement:
>
> select
>
> *
>
> from
>
> PARTS
>
> where
>
> cust=899
>
> So i need to import this data over and over again until I get every
> single folder 1-1000... into one single table.
>
> I hope someone can send me in the right direction.
>
> Thanks

You need a method to search directories. Here's a start
http://groups.google.com/group/comp.databases.ms-access/brow se_thread/thread/10ec246349b1200f/0e3c677c0e3bfab3?hl=en&lnk =st&q=#0e3c677c0e3bfab3

In Groups.Google.Com, for group *access*, look for "Recursive Directory
Search" or words to that effect. You'll find the code to loop through
all of your folders sooner of later.

Once you have that part down you can easily modify the code to open up
your files and inport the data.