View Single Post
Old 06-13-2019, 04:14 AM   #1
Newly Registered User
Join Date: Jun 2019
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
machinetech is on a distinguished road
Pulling two queries back into one

I have a parent table that contains a list of all of the machines my company owns (Table 1). There is another table that contains all of our maintainence records(Table 2). From the maintainence records table I then create a query (Query 1) that predicts the next maintainence date based off of the most recent entry for that specific machine.
However there are some machines that have never been maintainanced, so I have identified these machines by using an unmatched query between Table 1 and Query 1. From the unmatched Query I created a Query that calculates when these machines should receive there first service (Query 2).

Now essentially what I want is a query that contains all of the machines with their expected maintainance dates. I have tried several different iif statements without any luck.

I'm thinking maybe if I could make a query of Table 1, and say that if the machine exists in Query 1 then the field will equal true, and if not false. Then I would be able to make an iif, if the field is true, pull date from query 1, if false query 2.

Sorry for being long winded, but I figured it would be best to give the whole scenario rather than just the 2 queries I have. I can post sample data in a reply if needed. Thanks for any advice.

machinetech is offline   Reply With Quote