By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Indexed property

P: n/a
Indexed.Yes (Duplicates OK).

In my code for remote control i wanted to remove the property Indexed
of a field, but i receive the date type conversion error.How can i
change these properties by code ?
At the end of the list of the properties of the field,just below
Required, it is written Indexed.Yes (Duplicates OK). i want to turn it
to No and i write False, but it says property is unkown. What is the
exact property and the command to turn it to No ?

Below is a part of my code
Set tdf = dbs.TableDefs("customers")
Set fld = tdf.Fields("afid")
fld.Properties("Indexed") = False
dbs.Close
Set fld = Nothing
Set tdf = Nothing
Set dbs = Nothing
Set wsp = Nothing

etc

The Access interface is not the same as the DAO object model. I know I
will have to loop through the Indexes collection of the TableDef, and
loop through the Fields collection of each index to see if the field
is among them.
And if so, to delete the index. Of course, it is much easier to delete
the index in the Access interface,but for the time being I cannot do
that, I have no access to the Access interface and i will have to send
the code and beside I have about 7 users in different towns that makes
the matter difficult to me.
Is it possible to help me writing out the code for that? I will be
much indebted..

Feb 11 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If you created the databbase, you probably know the name of the index (which
defaults to the same name as the field), so all you need is:
Currentdb.TableDefs("tblInvoice").Indexes.Delete "InvoiceDate"

If you don't know the name, you will need to loop through the Indexes
collection as you say. Be aware that that there could be more than one index
on the same field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"solar" <sp*******@gmail.comwrote in message
news:11*********************@k78g2000cwa.googlegro ups.com...
Indexed.Yes (Duplicates OK).

In my code for remote control i wanted to remove the property Indexed
of a field, but i receive the date type conversion error.How can i
change these properties by code ?
At the end of the list of the properties of the field,just below
Required, it is written Indexed.Yes (Duplicates OK). i want to turn it
to No and i write False, but it says property is unkown. What is the
exact property and the command to turn it to No ?

Below is a part of my code
Set tdf = dbs.TableDefs("customers")
Set fld = tdf.Fields("afid")
fld.Properties("Indexed") = False
dbs.Close
Set fld = Nothing
Set tdf = Nothing
Set dbs = Nothing
Set wsp = Nothing

etc

The Access interface is not the same as the DAO object model. I know I
will have to loop through the Indexes collection of the TableDef, and
loop through the Fields collection of each index to see if the field
is among them.
And if so, to delete the index. Of course, it is much easier to delete
the index in the Access interface,but for the time being I cannot do
that, I have no access to the Access interface and i will have to send
the code and beside I have about 7 users in different towns that makes
the matter difficult to me.
Is it possible to help me writing out the code for that? I will be
much indebted..
Feb 11 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.