Help with access, please

S

Stephen

Been messing with access for the past few hours and can't
figure it out. I have a table with two foreign keys and
two other tables that use these as primary keys. What am
I suppose to write in the validation slot that will only
allow the input from the tables as primary keys. I keep
writing something to the effect of: "must exist" In
("tblDepartment"). This is written in my tblEmployee
table and one just like it in the Employee table for
JobCode. It does not work and I am lost. Can someone
please help me.
 
J

John Vinson

Been messing with access for the past few hours and can't
figure it out. I have a table with two foreign keys and
two other tables that use these as primary keys. What am
I suppose to write in the validation slot that will only
allow the input from the tables as primary keys. I keep
writing something to the effect of: "must exist" In
("tblDepartment"). This is written in my tblEmployee
table and one just like it in the Employee table for
JobCode. It does not work and I am lost. Can someone
please help me.

I'm not quite sure I understand what you're asking but... it seems you
may be trying too hard.

If you want Access to "Enforce Relational Integrity" - i.e. to
prohibit entry of an invalid job code - all you need to do is open the
Relationships window and create a join line between the primary key of
the JobCode table and the foreign key in the Personnel table
(similarly for Department).

Job done. No code, no expressions, nothing. If you try to enter XYZ in
the jobcode field (in table datasheet view, form view, any view) there
will be an error message when you try to save the record, and you
won't be able to get around it.
 

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