Solved

Select values from one table to use as parameters in another SQL in Access 2000

Posted on 2008-10-22
3
173 Views
Last Modified: 2010-05-18
I have a simple table named duedates that contains 1 record.  This record contains an OpenDate and CloseDate.

I want to grab these two values from this table and use them in a different SQL select to pull data from two tables that have been submitted between these two dates.

The code I have provided shows these dates as being 'hard coded' in the SQL select statement.

Is there a way from within Access 2000's SQL query view to create a SQL statement that will grab these two dates and use their values instead of having to hard code it or having to enter it manually each time the query is run.

Thanks in advance for your help!
SELECT Applications.Resa, Applications.ApplicationID AS ApplicationID, Applications.Equipment, Applications.ServiceLearning, Applications.MathScience, Applications.BudgetRequest, Applications.ProjectTitle, Applications.SubjectArea, Applications.GradeLevel, Applications.Summary, Applications.Objectives, Applications.ParentsInvolved, Applications.TeachersInvolved, Applications.StudentsInvolved, Applications.Caucasian, Applications.AfricanAmerican, Applications.Asian, Applications.LatinoHispanic, Applications.NativeAmerican, Applications.Other, Applications.EvaluateProject, Applications.Schedule, Budget.ApplicationID AS BudgetApplicationID, Budget.LineItem, Budget.Supplier, Budget.Quantity, Budget.UnitCost, Budget.TotalCost

FROM Applications INNER JOIN Budget ON Applications.ApplicationID=Budget.ApplicationID

WHERE Applications.DateSubmitted Between #7/31/2007# And #10/26/2007# And Applications.Resa=[Enter Resa Number]

ORDER BY Applications.Resa, Applications.ApplicationID;

Open in new window

0
Comment
Question by:sadoman
  • 2
3 Comments
 
LVL 7

Expert Comment

by:Cedric_D
ID: 22777343
use CROSS JOIN:
SELECT Applications.Resa, Applications.ApplicationID AS ApplicationID, Applications.Equipment, Applications.ServiceLearning, Applications.MathScience, Applications.BudgetRequest, Applications.ProjectTitle, Applications.SubjectArea, Applications.GradeLevel, Applications.Summary, Applications.Objectives, Applications.ParentsInvolved, Applications.TeachersInvolved, Applications.StudentsInvolved, Applications.Caucasian, Applications.AfricanAmerican, Applications.Asian, Applications.LatinoHispanic, Applications.NativeAmerican, Applications.Other, Applications.EvaluateProject, Applications.Schedule, Budget.ApplicationID AS BudgetApplicationID, Budget.LineItem, Budget.Supplier, Budget.Quantity, Budget.UnitCost, Budget.TotalCost

FROM Applications INNER JOIN Budget ON Applications.ApplicationID=Budget.ApplicationID

CROSS JOIN DueDates

WHERE Applications.DateSubmitted Between DueDates.OpenDate And DueDates.CloseDate And Applications.Resa=[Enter Resa Number]

ORDER BY Applications.Resa, Applications.ApplicationID;

Open in new window

0
 

Author Comment

by:sadoman
ID: 22799644
I tried the cross join but it gives me an error message.  I've been searching information on cross joins and I'm not sure if it works in Access 2000.  
0
 
LVL 7

Accepted Solution

by:
Cedric_D earned 250 total points
ID: 22799882
well, then any CROSS JOIN can be replaced by INNER JOIN ON 1=1
or INNER JOIN ON T1.SOMEFIELD=T1.SOMEFIELD
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now