I have a query:
(Sorry, the query is too wide in design grid to capture a screen shot of)
It is sopposed to select all records for the user determines one of three fields = true. The field that must = true is determined by the value of the [Spp] list box on a dialog form.
For example if [Spp] = SAL, the query selects all records for which [Salmon Processor] = True, regardless of whether [Mussel Processor] and/or [Oyster Processor] are true or false for those records.
Basically it compiles a list of all Salmon Processors, to feed into another report.
The selection process is controlled by three IIF functions that appear after HAVING in the SQL above.
This query has been working fine for several months. Today (report day) it has stopped working and returns the error message.
It does this only if OYS or SAL are selected in [Spp] on the dialog form. It works fine if GSM is selected. There are records it should be selecting in each case. Oddly these two selections return the smallest recordsets
I can't figure this out. Any help form someone with more experience would be greatly appreciated. I need to run these monthly reports today!!
Code:
SELECT tblContacts.Name, tblContacts.[Mussel Processor], tblContacts.[Salmon Processor], tblContacts.[Oyster Processor], tblLevyReceiptsHeader.AutoID, tblLevyReceiptsHeader.Paid, tblLevyReceiptsHeader.DateAdded
FROM tblContacts LEFT JOIN tblLevyReceiptsHeader ON tblContacts.ID = tblLevyReceiptsHeader.Processor
GROUP BY tblContacts.Name, tblContacts.[Mussel Processor], tblContacts.[Salmon Processor], tblContacts.[Oyster Processor], tblLevyReceiptsHeader.AutoID, tblLevyReceiptsHeader.Paid, tblLevyReceiptsHeader.DateAdded
HAVING (((IIf([Forms]![LevyReportDialog]![spp]="SAL",[Salmon Processor]=True,True))=True) AND ((IIf([Forms]![LevyReportDialog]![spp]="GSM",[Mussel Processor]=True,True))=True) AND ((IIf([Forms]![LevyReportDialog]![spp]="OYS",[Oyster Processor]=True,True))=True));
(Sorry, the query is too wide in design grid to capture a screen shot of)
It is sopposed to select all records for the user determines one of three fields = true. The field that must = true is determined by the value of the [Spp] list box on a dialog form.
For example if [Spp] = SAL, the query selects all records for which [Salmon Processor] = True, regardless of whether [Mussel Processor] and/or [Oyster Processor] are true or false for those records.
Basically it compiles a list of all Salmon Processors, to feed into another report.
The selection process is controlled by three IIF functions that appear after HAVING in the SQL above.
This query has been working fine for several months. Today (report day) it has stopped working and returns the error message.
"No Current Record" (Error 3021).
It does this only if OYS or SAL are selected in [Spp] on the dialog form. It works fine if GSM is selected. There are records it should be selecting in each case. Oddly these two selections return the smallest recordsets
I can't figure this out. Any help form someone with more experience would be greatly appreciated. I need to run these monthly reports today!!