Ms-access – Setting up relationships properly with the Access UI

database-designms accessms-access-2013

I am making the database design of my website in Microsoft Access 2013 because it has a nice user interface and I believe it will help me understand everything a whole lot better with the UI.

I have to create a relationship between two fields in one table with one field in the other – have I done this correctly (please see the screen capture below)? If not, what would I do to correct my errors?

enter image description here

Thanks in advance.

Best Answer

I'm with Michael, you should reference the IP ID, not the IP. If you don't link to the primary key, whenever you reference [IP used when creating] or [IP last signin], you are going to get the first record found. e.g. you have multiple records with the same IP in you ips table, you are going to always get the result of the first one. This is why primary keys are so important, they ensure you get the same record every time. If you can assume that a particular IP will always have the same Hostname, Location, Region, etc., then you can sue IP as your reference.

On a side note, if you have to run any SQL or VBA against your database, it's a lot easier if you avoid spaces in your names, use Camel case or something else. e.g. "IP used when creating" should be IPusedWhenCreating. This makes any type of programming a lot easier. I'm very oldschool and I like to keep variables to under 8 characters whenever possible. FirstIP and SecondIP, it just means a LOT less typing.