I've read this thread https://www.accessforums.net/queries...eys-18435.html and the associated external link http://access.mvps.org/access/lookupfields.htm several times - I'm having essentially the same issue. I'm not sure if I'm reading it wrong, but it looks like a bunch of statements without a solution. How am I supposed to deal with this situation?
I have a database that for all intents has four tables
1. key information (standard primary key, key number is alphanumeric and stored as a text object).
2. signout information - long term
3. signout information - short term
4. user information
I have two queries set up that return all keys currently signed out. These work fine, and return the correct results.
What I need to do next is create a query that puts together both the long term and short term keys signed out, and then filters so that it only includes results from the named individual input (the point being for us to query someone who leaves so we can get their keys back). I've created a union query from the two queries that return all keys signed out, but instead of returning the key number, it returns the primary key for the key number. It actually works fine when I create the query, but when I save, close and re-run it, it starts returning the primary key.
My SQL for this query looks like this -
SELECT Who, [Key Number]
FROM qry_allcurrentshorttermout
UNION ALL
SELECT Who, [Key Number]
FROM qry_allcurrentlongtermsignout;
I don't understand why my long and short term queries on their own are returning the correct values for key numbers, but another query based on them doesn't.
Can anyone help me see the light?