hi,
Could it be possible to find out primary key in a table and then redine the
primary key .
Sure, open the table in design view, and locate the key symbole on the
left side of each field. Mark the new fields and press the key button.
To do it in VBA you need to inspect the Indexes collection of a TableDef
object, e.g.
Dim db As DAO.Database
Dim fd As DAO.Field
Dim ix As DAO.Index
Dim td As DAO.TableDef
Set db = CurrentDb
Set td = db.TableDefs.Item("Information")
For Each ix In td.Indexes
Debug.Print ix.Name;
If ix.Primary Then
Debug.Print ":";
For Each fd In ix.Fields
Debug.Print " "; fd.Name;
Next fd
End If
Debug.Print
Next ix
Set td = Nothing
Set db = Nothing
To redefine the primary key you need to remove this index from the
Indexes collection and add an new index with Primary = True.
mfG
--> stefan <--