Open Side Menu Go to the Top

12-22-2011 , 03:33 PM
We currently have a program that uses an access database connecting using an ODBC driver.

On particular table named Expenses has a field name ExpenseNumber

We recently redesigned the way some data was stored in the database and now Expenses.ExpenseNumber can have the same information in multiple rows (we are now permitting duplicates).

I have figured out how to change this setting in access
-- Open design view of the table
-- Selecting the field
-- Change Indexed from YES (No Duplicates) to YES (Duplicates OK).

The problem is that I can not ask people to do this by hand for every database so is there a way to do the above in C++?
Changing Properties of a Field in Access Database Programatically Quote
Changing Properties of a Field in Access Database Programatically
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
Changing Properties of a Field in Access Database Programatically
12-22-2011 , 07:45 PM
Access has it's own version of SQL so you can run an Alter Table query using the Constraint clause (or possibly a Create Index statement) against the database through the ODBC connection.

http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx
Changing Properties of a Field in Access Database Programatically Quote
12-22-2011 , 07:50 PM
There's also tons of 3rd party controls for editing access databases that you can just drop in your program, to do whatever you want without writing the code for it.
Changing Properties of a Field in Access Database Programatically Quote
12-23-2011 , 01:27 PM
Do multiple people have different instances of this database?
Changing Properties of a Field in Access Database Programatically Quote
12-24-2011 , 12:37 AM
Quote:
Originally Posted by SuperRams
Do multiple people have different instances of this database?
ewww that sounds like a nightmare scenario!
Changing Properties of a Field in Access Database Programatically Quote
12-24-2011 , 04:32 PM
I ended up figuring it out by simply droping the index and recreating it.

seems to work.... not really sure the difference between an index and the fields
Changing Properties of a Field in Access Database Programatically Quote
Changing Properties of a Field in Access Database Programatically
150% up to $2,000 Welcome Bonus on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
Changing Properties of a Field in Access Database Programatically

      
m