Link to home
Start Free TrialLog in
Avatar of J-Rodder
J-Rodder

asked on

Cross updating records using lookup tables

Completely new to Access, trying to build an app for management of some company assets. Currently, just a simple setup utilizing the assets template from Access. Two tables right now, one for Vans, and another for Technicians. Using lookups, (even though I have read that it's not recommended practice?) it does seem to work... almost. If I create a van record, using the technician lookup, it will create the proper van record with Van Number and Tech Number, but of course in the tech table, Van Number is still a null value. I'd like them both to be updated when creating and editing records.

I was thinking about trying to make a logic for "After Update" or maybe even within the table itself, to do a cross update?

I am also wondering if this is attacking the problem in the wrong way. Should I not be using lookups and instead, figuring out how to create queries and macros? I need to ensure there's no duplicate data, there will be vans without techs, and techs without vans, but never a tech in 2 vans, for instance.
Avatar of als315
als315
Flag of Russian Federation image

May be you can upload your DB with tables and some sample data? Cross-reference in your case seems wrong.
Avatar of J-Rodder
J-Rodder

ASKER

I am using Access 2013 and Sharepoint 2013, tied to SQL2012. You would only need to look at the SQL database?
You can make screenshots with tables design, it will be enough.
Okay, here goes. I am attaching the table links, and the query results after creating data in the following way:

Vans 10 and 20 created without entering tech number
make tech Jared Clark without entering van number
make tech Jose Miranda using existing van data (20)
make tech Mike Sellers 709 and making a new van entry before saving record.

Maybe this helps? I would like to enter data into the tech form, and have it also update the corresponding record in the van table, and vice versa.
query-results.png
table-links.png
You don't need field Van_Number in tbl_Technicians. or in table tbl_Vans.
You declare "but never a tech in 2 vans": may one van has 2 techs? If answer is - No, you should have one-to-one. If you like to have history of tech-van assignment, you may have separate table van-tech with vanID, techID, datefrom, dateto etc. To prevent duplicates - add
composite index:
http://blogs.msdn.com/b/mssqlisv/archive/2008/09/26/designing-composite-indexes.aspx
Well maybe I could have been slightly more clear. I do need a Van Number field in the tbl_Van, as that's how we identify the vans. They have an actual number sticker on each vehicle, and that's how we track them. I think you are right about the one to one, and I will look into the composite index. As I feared, this is more due to my complete ignorance of how to properly structure the database. The lookup fields gave me the data I wanted in the web interface, but I was thinking that I might run a query against just the van table, and it wouldn't give me the data I want.

From what I understand at this point, a proper query would more likely involve pulling the proper columns and records from all involved tables.

It gets slightly more complicated (for me) because I will also need to have an invoice table,  connected to the vans, that will I guess be a one to many relationship? Each van will certainly have more than one invoice attached to it.

It looks like I have a lot to learn. My current problem is that most of the Access books I have found are more for the application side, and not the web databases, which are significantly different. Maybe later this year I can score some of these 2013 books on pre-order that deal with this whole Access/Sharepoint App nonsense.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the help and clarification, I am sure I will return later with other questions!
You are welcome