MAIN SQL:
-------------------
SELECT Admit.AdmitID, Admit.ClientID, Admit.AdmitDate, Admit.DischargeDate, DateDiff("d",[AdmitDate],[Dischargedate]) AS StayRange, IIf(DateDiff("d",[Admit].[AdmitDate],[Admit].[Dischargedate])<=7,True,False) AS Under7Days, qryGoalDays.OpenDate, qryGoalDays.CloseDate, qryGoalDays.GoalDays, DateAdd("d",[qryGoalDays].[GoalDays],[qryGoalDays].[OpenDate]) AS FinalDate, IIf(IsNull([CloseDate]-[FinalDate]),"0",([CloseDate]-[FinalDate])) AS StayedComp
FROM Admit INNER JOIN qryGoalDays ON Admit.AdmitID = qryGoalDays.AdmitID
WHERE (((Admit.DischargeDate)>=#12/31/2008# Or (Admit.DischargeDate) Is Null) AND ((IIf(DateDiff("d",[Admit].[AdmitDate],[Admit].[Dischargedate])<=7,True,False)) Not Like -1) AND ((qryGoalDays.GoalDays) Not Like 0) AND ((DateAdd("d",[qryGoalDays].[GoalDays],[qryGoalDays].[OpenDate]))>=[Forms]![frmReportDateRange]![txtBeginDate] And (DateAdd("d",[qryGoalDays].[GoalDays],[qryGoalDays].[OpenDate]))<=[Forms]![frmReportDateRange]![txtEndDate]));
PROBLEM SQL:
-----------------------
SELECT Count([FinalDate]) AS TotalGoals
FROM qry7DayCutOff;
WHERE ERROR 3061 SHOWS UP IN VBA:
-----------------------
Private Sub Report_Open(Cancel As Integer)
Dim strCloseDate As String
Dim strSQL As String
Dim strFilterDays As String
Dim db As Database
Dim rs As Recordset
mstrBeginDate = Forms!frmReportDateRange!txtBeginDate
mstrEndDate = Forms!frmReportDateRange!txtEndDate
'Setup
Set db = CurrentDb
'Count of clients whose goal plans closed this period
strSQL = "SELECT [TotalGoals] FROM qry7Total"
Set rs = db.OpenRecordset(strSQL) <--- right here is the "Too few parameters. Expected 2."
|