Question : UNION QUERY WITH DATE PARAMETERS

Good afternoon.  I have what I think is a simple question, however, cannot figure it out for the life of me...

I created the following query, however, cannot seem to set it up so that the user only needs to enter the [Entry Date] range once.  Other than that, it works fine and is providing me with valid results.  Any assistance would be greatly appreciated  :)

SELECT [1 CALL ID BLOCK  ].[ENTRY DATE], [1 CALL ID BLOCK  ].[USER ID], [1 CALL ID BLOCK  ].[ACCOUNT], [w3].[Dept], [w3].[Location], [w3].[name],[W3].[Emp id]
FROM [1 CALL ID BLOCK  ] INNER JOIN w3 ON [1 CALL ID BLOCK  ].[USER ID]=[w3].[ICOMS]
WHERE  (([w3].[Dept]) Like "hsd*" Or ([w3].[Dept]) Like "voice*" Or ([w3].[Dept]) Like "customer*") And (([w3].[Location]) Like "bag*" Or ([w3].[Location]) Like "wilkes*" Or ([w3].[Location]) Like "kings*") and [Entry Date]  BETWEEN [Enter Startdate:] and [Enter Enddate:]

UNION SELECT [1 CALL BLOCK  ].[ENTRY DATE], [1 CALL BLOCK  ].[USER ID], [1 CALL BLOCK  ].[ACCOUNT], [w3].[Dept], [w3].[Location], [w3].[name],[W3].[Emp id]
FROM [1 CALL BLOCK  ] INNER JOIN w3 ON [1 CALL BLOCK  ].[USER ID]=[w3].[ICOMS]
WHERE  (([w3].[Dept]) Like "hsd*" Or ([w3].[Dept]) Like "voice*" Or ([w3].[Dept]) Like "customer*") And (([w3].[Location]) Like "bag*" Or ([w3].[Location]) Like "wilkes*" Or ([w3].[Location]) Like "kings*") and [Entry Date]  BETWEEN [Enter Startdate:] and [Enter Enddate:]


UNION SELECT [1 LD SERVICE  ].[ENTRY DATE], [1 LD SERVICE  ].[USER ID], [1 LD SERVICE  ].[ACCOUNT], [w3].[Dept], [w3].[Location], [w3].[name],[W3].[Emp id]
FROM [1 LD SERVICE  ] INNER JOIN w3 ON [1 LD SERVICE  ].[USER ID]=[w3].[ICOMS]
WHERE  (([w3].[Dept]) Like "hsd*" Or ([w3].[Dept]) Like "voice*" Or ([w3].[Dept]) Like "customer*") And (([w3].[Location]) Like "bag*" Or ([w3].[Location]) Like "wilkes*" Or ([w3].[Location]) Like "kings*") and [Entry Date]  BETWEEN [Enter Startdate:] and [Enter Enddate:];


Sincerely,
Nikki

Answer : UNION QUERY WITH DATE PARAMETERS

create a query that uses the union query....move the criteria out of the union into the new query.
Random Solutions  
 
programming4us programming4us