I have an Access database where I want to store the contacts in a company: In this database I have a table named "users" where I keep the users which will have access to the database. In the main table, named "contacts", two of my fields "insert_user" and "contact_user" refer to the user who entered the contact information and the user who actually made the contact. The way I am thinking it, I will have to set both of the fields as foreign keys to the same table/field, namely "users"/"username".
So: I set two foreign key constrains in two different fields ("insert_user", "contact_user"), which refer to the same table/field ("users"/"username") in an Access database, using VB.Net OleDB (See the SQL Statement below)
ALTER TABLE contacts ADD CONSTRAINT insert_user_foreignkey FOREIGN KEY (insert_user) REFERENCES users (username)
ALTER TABLE contacts ADD CONSTRAINT contact_user_foreignkey FOREIGN KEY (contact_user) REFERENCES users (username)
I open the database with MS-Access. I see that all the tables are fine (as they should be).
However when I click on relationships at Access I get all my tables plus a table named users_1 connected to "contacts"/"contact_user" (the table users is only connected to "contacts"/"insert_user")
It is very strange that in the Table View of Access I don't see this table, but only in the Relationships View.
Questions
- Is my thinking right (to set 2 foreign keys, that refer to the same table/field)?
- What is this table "users_1"?
- Will my database work or am I doing something wrong?