How to get table primary key

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello!
I have to chech if some table column is table primary key.
Here are code to get to the table column:
For Each tabula As dao.TableDef In ACS.TableDefs
If tabula.Name.ToUpper.Trim = sName.ToUpper.Trim Then
For Each lauks As dao.Field In tabula.Fields
If lauks.Name.ToUpper.Trim = sColName.ToUpper.Trim Then
'???
End If
Next
End If
Next

after that i need to know is it primary key or not and is this column is
indexed or not!
I hope you will help me soon!

Dexter
 
hi Dexter,
I have to chech if some table column is table primary key.
Use the Indexes collection, e.g.
For Each tabula As dao.TableDef In ACS.TableDefs

For Each idx In tabula
If idx.Primary Then
MsgBox "Primary Key: " & idx.Fields
End If
Next idx


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top