Steve,
Thanks for the tip. Unfortunately, I still not getting
any results if I leave the combo box empty (a null)
but
do get results if I select a single event.
Using the watch window I noted that the value of the
combo box (cboEventList.Value) shows "3" (with the
quotes) for a single event and a "null" if left
blank.
The type is shown as a Variant/String (for the combo
box)
even though the ID field in the table is long number.
This, of course has me really confused.
Just for laughs I also tried just entering a ">0"
argument (without the quotes) in the criteria of the
query and did get all events to list.
Any other suggestions?
Thanks for the help
Carl
I'm confused now also. In the IIF() function, you are
testing for [intEventID]>0
but in your now you are referencing [cboEventList].
Please post the SQL of the combo box rowsource and the
name of the combo box.
Steve,
I apologize for the confustion. I use form code that
calls the Query. While experimenting in that code, I was
taking the value of [cboEventList] and storing it in
[intEventID] then using [intEventID] to test for the
value of >0.
The SQL query is shown below:
SELECT tblPayrollEvent.ID, tblPayrollEvent.Event,
tblPayrollEvent.EventDate, tblPayCode.PayCode,
tblVenueTable.VENUE, tblPayrollEvent.MS_SS,
tblPayrollEvent.AutoDeduction, tblNameMaster.Name,
tblPayroll.AcctNo, tblPayroll.WorkDate,
tblPayroll.InCrew, tblPayroll.InHours, tblPayroll.InOT,
tblPayroll.InDT, tblPayroll.InGross, tblPayroll.WorkCrew,
tblPayroll.WorkHours, tblPayroll.WorkOT,
tblPayroll.WorkDT, tblPayroll.WorkGross,
tblPayroll.ContCrew, tblPayroll.ContHours,
tblPayroll.ContOT, tblPayroll.ContGross,
tblPayroll.ShowCrew, tblPayroll.ShowHours,
tblPayroll.ShowGross, tblPayroll.OutCrew,
tblPayroll.OutHours, tblPayroll.OutOT, tblPayroll.OutDT,
tblPayroll.OutGross, tblPayroll.GrossPay INTO
tblPayrollReport
FROM tblPayCode RIGHT JOIN (tblVenueTable RIGHT JOIN
(tblNameMaster RIGHT JOIN (tblPayroll LEFT JOIN
tblPayrollEvent ON tblPayroll.Event = tblPayrollEvent.ID)
ON tblNameMaster.AcctNo = tblPayroll.AcctNo) ON
tblVenueTable.VEN_CODE = tblPayrollEvent.Venue) ON
tblPayCode.ID = tblPayrollEvent.PayrollCode
WHERE (((tblPayrollEvent.ID)=IIf([Forms]![frmReports]!
[intEventID]>"1",[Forms]![frmReports]![intEventID],
[tblPayrollEvent].[ID]>1)));
This one is slightly different in that I added an "Event"
to the table the [cboEventList] references with an ID of
1 (hence the test for >1). In theory, I was getting
around the possibility of a "null" value. However, this
one also does not work as I'm intending.
The form code i'm using to call the query is as follows:
Me.intEventID = Nz(Me.cboEventList.Value, "1")
DoCmd.OpenQuery "qryPayrollReport"
Again, I appreciate the assist and am stumped on how to
resolve this.
Carl