J
Jonathan
Hi, using Access 2003. I want to import data from SQL. If I import to tables
that do not have any indexes the process takes a little over 2 hours with the
database building to 575 MB. When the Access database has indexes in the
tables the transfer fails because the database builds to over 2 GB during the
transfer. Unfortunately the data for now must be in Access format.
I tried to add the indexes after the transfer. I created a table in which I
cache the indexes and indexes' fields. My idea being to delete indexes before
the data import and then re-create after the import. I am hoping that I am
doing something wrong; rather than that this is not possible.
In the following code snippet I use a loop to append fields to an index
fields collection and then append the index to the collection of table
indexes. The problem is an error is triggered by the last line when appending
the index.
For fieldLoop = 0 To UBound(aAllIdxField())
Set idxField = idx.CreateField(aAllIdxField(fieldLoop))
idx.Fields.Append idxField
Next fieldLoop
tdf.Indexes.Append idx
I think the error is that the index fields collection already exists in the
table fields collection. The error is 3409 (Invalid field definition
'[Building_Name]' in definition of index or relationship.) in procedure
CreateTableIndex.
This field is an existing field containing data in this table. The index
name is not the same as the field name. The table does not have any existing
index.
So the question is... how can I add an index using VBA to an existing table
using fields that contain data?
Any ideas or suggestions appreciated
Many thanks,
Jonathan
that do not have any indexes the process takes a little over 2 hours with the
database building to 575 MB. When the Access database has indexes in the
tables the transfer fails because the database builds to over 2 GB during the
transfer. Unfortunately the data for now must be in Access format.
I tried to add the indexes after the transfer. I created a table in which I
cache the indexes and indexes' fields. My idea being to delete indexes before
the data import and then re-create after the import. I am hoping that I am
doing something wrong; rather than that this is not possible.
In the following code snippet I use a loop to append fields to an index
fields collection and then append the index to the collection of table
indexes. The problem is an error is triggered by the last line when appending
the index.
For fieldLoop = 0 To UBound(aAllIdxField())
Set idxField = idx.CreateField(aAllIdxField(fieldLoop))
idx.Fields.Append idxField
Next fieldLoop
tdf.Indexes.Append idx
I think the error is that the index fields collection already exists in the
table fields collection. The error is 3409 (Invalid field definition
'[Building_Name]' in definition of index or relationship.) in procedure
CreateTableIndex.
This field is an existing field containing data in this table. The index
name is not the same as the field name. The table does not have any existing
index.
So the question is... how can I add an index using VBA to an existing table
using fields that contain data?
Any ideas or suggestions appreciated
Many thanks,
Jonathan