Here I go at trying to explain this.. I have two queries. The first one pulls all records between two dates entered on a form. The second one then takes that date and counts the number of times each item appears. Then I have a report that lists out the data from the second query.
Query 1 (qryTransfersBetweenDate1ANDdate2)
INAME (Name of item from tblProducts)
OldLocation (Where the item was transferred from, from tblTransfers)
DateTransferred (The date the item was transferred, from tblTransfers)
Query2 (qryTransfersCountBetweenDate1ANDdate2)
ProductName Field (IName from Query1)
NumberOfDups (Count field to count all items from Query1 (NumberOfDups: IName)
Report (Yearly)
Product Name
Number of Dups
Form (Yearly Transferred)
Start Date
End Date
The idea is that you would enter the Start Date and End Date on the form. It would update Query 1 with those dates. Then the report would open and be sorted down to those results.
All the queries work.. The issue I am having is when I try to add in the form with the dates I want to use. These dates can change based on what the user is trying to look at.
I tried using this code in the Form's submit button:
Code:
DoCmd.OpenQuery "qryTransfersBetweenDate1ANDdate2", acViewNormal
DoCmd.ApplyFilter , "tblTransfers.[Date Transferred] Between #" & Me.StartDate & "# And #" & Me.EndDate & "#"
DoCmd.OpenReport "Yearly", acViewReport, , , acDialog
Any help would be greatly appreciated.
Thanks,
Z