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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting a query criteria from a table 2

Status
Not open for further replies.

itechC

Programmer
Feb 13, 2003
71
CA
Hello,

I need to set a between date criteria in my query by referencing the value in a table i have call tblCriterias. I am currently using Between [tblCriterias]![MonthlyTrendStart] And [tblCriterias]![MonthlyTrendEnd]. This isn't working. I tried entering the # in my table but that didn't work either. Any ideas on how to do this?
 
What is the actual SQL code of your query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
SELECT tblDialerSummaryMTD.Application, tblDialerSummaryMTD.DEL, tblDialerSummaryMTD.DATE
FROM tblDialerSummaryMTD
WHERE (((tblDialerSummaryMTD.Application) Like "whirl") AND ((tblDialerSummaryMTD.DEL)="DEL 2" Or (tblDialerSummaryMTD.DEL)="DEL 3") AND ((tblDialerSummaryMTD.DATE) Between [tblCriterias]![MonthlyTrendStart] And [tblCriterias]![MonthlyTrendEnd]));
 
You are attempting to reference fields in [tblCriterias] but that table does not appear in your FROM clause. You will need to do some sort of JOIN to that table to get this to work.
 
Code:
SELECT A.Application, A.DEL, A.DATE
FROM tblDialerSummaryMTD AS A, tblCriterias AS B
WHERE A.Application = 'whirl'
AND A.DEL In ('DEL 2','DEL 3')
AND A.DATE Between B.MonthlyTrendStart And B.MonthlyTrendEnd

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top