Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter two separate date fields

Status
Not open for further replies.

traycee

IS-IT--Management
Sep 6, 2001
245
US
Hi All!
I think it's possible but I'm just not getting it. tblClient has a one to many relationship with tblreferrals. tblreferrals has a one to many relationship with tblwork. I'm trying to build a query with client id, referral date, and work date. I want it to give me a list of clients, their referral date, and the dates they worked, if they worked, in a given quarter. I can filter the referral dates with no problem. But no matter what I try for the work date parameter, it continues to give me dates outside the range I'm checking for. I think the problem is that sometimes, there is no work info. So...it's not only just null...it doesn't exist yet. Is it possible to do this?
 
Can you post your SQL? It's almost impossible to guess which fields go with which tables or how you are attempting to filter them.
 
Hi...

SELECT tblClientInfo.ClientID, tblReferralInfo.ReferralDate, tblWorkInfo.DateWorked
FROM (tblClientInfo INNER JOIN tblReferralInfo ON tblClientInfo.ClientID = tblReferralInfo.ClientID) INNER JOIN tblWorkInfo ON tblReferralInfo.ReferralID = tblWorkInfo.ReferralID
GROUP BY tblClientInfo.ClientID, tblReferralInfo.ReferralDate, tblWorkInfo.DateWorked
HAVING (((tblReferralInfo.ReferralDate) Between [Forms]![frmQuarterlyInput]![Q1Begin] And [Forms]![frmQuarterlyInput]![Q1End])) OR (((tblWorkInfo.DateWorked)>=[Forms]![frmQuarterlyInput]![BeginDate] And (tblWorkInfo.DateWorked)<=[Forms]![frmQuarterlyInput]![EndDate] Or (tblWorkInfo.DateWorked)="IsNull"));

I know I can make a union query and then build a query on that query to get what I need....but that seems messy. Thanks for replying.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top