Using Access 2000
The SQL below is used to populate a report, and it has subqueries.
The SQL is supposed to select first by a criteria selection (a name) typed into a form, but regardless of what is typed in the query provides records for all names.
The line that is supposed to select only individual records is
WHERE (((tblCamper.CamperLast) Like [Forms]![frmNameSelector]![txtNameCheck] & "*")
SELECT DISTINCTROW tblCamper.CamperLast, tblCamper.CamperID, tblCamper.SiteNbr, tblCamper.CamperFirst, tblCamper.CamperLast2, tblCamper.CamperFirst2, IIf(IsNull([CamperFirst2]) And IsNull([CamperLast2]),[CamperFirst],[CamperFirst] & " and " & [CamperFirst2]) AS CamperFirstNames, IIf(IsNull([CamperLast2]),[CamperFirstNames] & " " & [CamperLast],[CamperFirst] & " " & [CamperLast] & " and " & [CamperFirst2] & " " & [CamperLast2]) AS CamperNames
FROM tblCamper
WHERE (((tblCamper.CamperLast) Like [Forms]![frmNameSelector]![txtNameCheck] & "*") AND ((tblCamper.CamperID) In (Select CamperID from qunInvoicesAndCredits))) OR (((tblCamper.CamperID) In (Select CamperID from qryCamperInterestSummary))) OR (((tblCamper.CamperID) In (Select CamperID from qryCamperPaymentsTotal)));
Any suggestions as to how to fix this, so that only the record for a specific name shows up?
Thanks.
Tom
The SQL below is used to populate a report, and it has subqueries.
The SQL is supposed to select first by a criteria selection (a name) typed into a form, but regardless of what is typed in the query provides records for all names.
The line that is supposed to select only individual records is
WHERE (((tblCamper.CamperLast) Like [Forms]![frmNameSelector]![txtNameCheck] & "*")
SELECT DISTINCTROW tblCamper.CamperLast, tblCamper.CamperID, tblCamper.SiteNbr, tblCamper.CamperFirst, tblCamper.CamperLast2, tblCamper.CamperFirst2, IIf(IsNull([CamperFirst2]) And IsNull([CamperLast2]),[CamperFirst],[CamperFirst] & " and " & [CamperFirst2]) AS CamperFirstNames, IIf(IsNull([CamperLast2]),[CamperFirstNames] & " " & [CamperLast],[CamperFirst] & " " & [CamperLast] & " and " & [CamperFirst2] & " " & [CamperLast2]) AS CamperNames
FROM tblCamper
WHERE (((tblCamper.CamperLast) Like [Forms]![frmNameSelector]![txtNameCheck] & "*") AND ((tblCamper.CamperID) In (Select CamperID from qunInvoicesAndCredits))) OR (((tblCamper.CamperID) In (Select CamperID from qryCamperInterestSummary))) OR (((tblCamper.CamperID) In (Select CamperID from qryCamperPaymentsTotal)));
Any suggestions as to how to fix this, so that only the record for a specific name shows up?
Thanks.
Tom