If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Using DLookUp and Date form to generate report
Help, I want to use DLookUp and a Date form to generate a report :
I have 2 queries qryTotal_Production and qryDowntime: qryDowntime: SELECT qryDowntimeUnion.Session, qryDowntimeUnion.Machine, qryDowntimeUnion.Shift, qryDowntimeUnion.Downtime_Code, Sum(qryDowntimeUnion.Downtime) AS SumOfDowntime, Format([Date],"dd-mmm-yyyy") AS [Downtime Date] FROM qryDowntimeUnion GROUP BY qryDowntimeUnion.Session, qryDowntimeUnion.Machine, qryDowntimeUnion.Shift, qryDowntimeUnion.Downtime_Code, Format([Date],"dd-mmm-yyyy") HAVING (((qryDowntimeUnion.Downtime_Code) Is Not Null) AND ((Sum(qryDowntimeUnion.Downtime)) Not Like "0")); qryTotal_Production: SELECT qryScrapUnion.Session, qryScrapUnion.Machine, qryScrapUnion.Shift, Sum(qryScrapUnion.Scrap_Kgs) AS SumOfScrap_Kgs, Format([Date],"dd-mmm-yyyy") AS [Scrap Date] FROM qryScrapUnion GROUP BY qryScrapUnion.Session, qryScrapUnion.Machine, qryScrapUnion.Shift, Format([Date],"dd-mmm-yyyy") HAVING (((Sum(qryScrapUnion.Scrap_Kgs)) Not Like "0")); I have an unbound report called "test" which has some of these text boxes: i) txtE1 ii) txtProduction. The controlsource of is like this and works perfectly: =Nz(DLookUp("[SumOfDowntime]","qryDowntime","[Downtime_Code] = '" & 3 & "'AND [Machine]= '" & 1 & "'"),0) 1. How can i create a form where a user can input a date and the DLookUp above creates the correct info for that particular date on the report. 2. How can i create a DLookUp on the controlsource of txtProduction based on qryTotal_Production where it presents [SumOfScrap_Kgs] from qryTotal_Production where [Scrap Date] = to the the date entered by a user on the form created above. Thank you in advance! PS. Iam an access 2002 novice. -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|