> Thanks fo the help Douglas. Of course you were correct and your
> suggestions worked. When I get to the line of code trying to append the
[quoted text clipped - 75 lines]
>>>> Set db = Nothing
>>>> End Sub
It should be possible, but it also shouldn't be necessary...
Your code is trying to create an index named Field1. If you're actually
trying to use an existing index, replace
Set idx = tdf.CreateIndex("FIELD1")
with
Set idx = tdf.Indexes("FIELD1")
and remove the tdf.Indexes.Append idx line.
However, you say this is the primary key, yet you're trying to use
idx.Unique = False
A primary key MUST be unique.
FWIW, the primary key index is normally named PrimaryKey.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> I tried deleting the index first then recreating it and that ran me through
> the code without an error but made no change to the table index when I
[quoted text clipped - 84 lines]
> >>>> Set db = Nothing
> >>>> End Sub
Gibson - 28 Nov 2005 21:42 GMT
Thanks for you expertise.Your clue on the name of the primary key index as
PrimaryKey is what did it. It could not find the name in the collection
because I was using the wrong name. Once changed to PrimaryKey it worked
fine. I do have one another question dealing with the same project but
slightly different topic. I don't know the protacol meaning if I should ask
it here or create a new thread. I'll include it here and if this is
incorrect feel free to let me know.
I'm trying to create a table in the backend mdb from code within the
frontend. I am using the following code:
Dim cat As ADOX.Catalog
Dim Tbl As ADOX.Table
On Error GoTo Err_Tbl
Set cat = New Catalog
cat.ActiveConnection = CurrentProject.Connection
Set Tbl = New Table
With Tbl
.Name = "flkpNumber"
With .Columns
.Append "Number", adDouble, 10
End With
End With
cat.Tables.Append Tbl
The problem is this is creating the new table in the frontend instead of in
the backend mdb. I assume it has to do with the setting of the
cat.ActiveConnection line but I'm lost. How can I direct this code to
create the new table in the backend mdb.
Thanks again for all the help, it's greatly appreciated.
> It should be possible, but it also shouldn't be necessary...
>
[quoted text clipped - 117 lines]
>> >>>> Set db = Nothing
>> >>>> End Sub
Douglas J. Steele - 28 Nov 2005 22:44 GMT
Why are you using ADOX here, but DAO in the previous example?
Your previous example was working the backend database, wasn't it?
To be honest, I never use ADOX with Access: DAO was developed specifically
to be used with Jet databases (i.e. MDB files), and is the preferred
approach.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Thanks for you expertise.Your clue on the name of the primary key index as
> PrimaryKey is what did it. It could not find the name in the collection
[quoted text clipped - 27 lines]
>
> Thanks again for all the help, it's greatly appreciated.