how to determine if primary key is set

K

Keith G Hicks

I have a system for a client where a couple of tables periodically lose
their primary key indexes and the associated FK's get blown away. We have
not been able to determine why this happens and it is very frustrating. I
decided instead to write some code that will run each time a user opens up
the front end to determine if certain PK's are still there and also test for
the related FK's. But I'm not sure how to go about that. Can anyone point me
to vba samples that check this sort of thing?

For example, I have a table called tblInvoices. The PK is on the field
InvoiceID. I want to run some vba to be sure that field is still the PK and
I also want to be sure that it's still connected to the child tables.

Thanks,

Keith
 

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

Top