Modify field index property using VBA

dogdays

Active Member
Joined
Apr 28, 2008
Messages
434
Office Version
  1. 2007
Win 7 64, Access 2007.
At run time I would like to change the field index property .
I want to go from indexed (yes(Duplicates OK) to indexed yes(NO Duplicates) and vice versa.

tia Jack
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Re: Modify fielld index property using VBA

Not sure but I think with Access you won't be able to go from "Duplicates allowed" to "No Duplicates allowed" unless there are no duplicates or you remove them first.
 
Upvote 0
Re: Modify fielld index property using VBA

My plan is to load the table with either no index or index, duplicates OK.
Then delete the duplicates and then index no duplicates.

Jack
 
Upvote 0
Re: Modify fielld index property using VBA

So did Joe's links help?
ξ
 
Upvote 0
Re: Modify fielld index property using VBA

Yes Joe's links did help.
I finally got it all together, there probably is a more elegant way, but mine worked.
1. Created a copy of the table I would be populating using SQL no indexes present or primary key , without a field named nIdnetity, (All of my tables use nIdentity as primary key with autonumb).
2. Added field nIdentity set as an autonumb field. (could not figure how to alter a field to autonumb (many google searches))
3. Populated table with a select.
4. Dropped all duplicate rows.
5. Created indexes on two fields.
All is well.
Thanks for the help.

Jack
 
Upvote 0

Forum statistics

Threads
1,217,241
Messages
6,135,433
Members
449,932
Latest member
sbog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top