kbdaemon
asked on
Challenging Access question: conditional date range query between two tables
I have two tables in Access 2010 (database4 is attached) with test data. One table contains agents by code and the amount of commission they earn for selling product "WLLB". The other table contains commission levels by date. Commission contracts change over time and we are reconstructing some really old data for export to a newer system (for records purposes).
I need to create a query to return records where:
1) [AgentTestRecords].AgtComm = [CommLevelsByDate].CommPct Yr1 AND
2) [AgentTestRecords].PolType = [CommLevelsByDate].Product Code AND
3) [CommLevelsByDate].ANBTo = 70 AND
4) [AgentTestRecords].Contrac tDate => [CommLevelsByDate].ValidFr om and <=[CommLevelsByDate].Valid To
The result set would be: [AgentTestRecords].Agt as AgentCode, [CommLevelsByDate].Produce rTier as ProducerTier, [CommLevelsByDate].ValidFr om as CommScheduleDate and [AgentTestRecords].Contrac tDate as ContractDate
So, I know what I want but I am in over my head on doing something that looks like a union with a bunch of conditionals versus my simple select query experience. Thanks in advance for any help!
Kirk
Database4.accdb
I need to create a query to return records where:
1) [AgentTestRecords].AgtComm
2) [AgentTestRecords].PolType
3) [CommLevelsByDate].ANBTo = 70 AND
4) [AgentTestRecords].Contrac
The result set would be: [AgentTestRecords].Agt as AgentCode, [CommLevelsByDate].Produce
So, I know what I want but I am in over my head on doing something that looks like a union with a bunch of conditionals versus my simple select query experience. Thanks in advance for any help!
Kirk
Database4.accdb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks! that gets me exactly what I need.
ASKER