S
SillySally
Hello. I have a query that uses an input parameter.
I've modified the query and can't figure out why it is no
longer being limited by the parameter. The user selects
the State and mailing labels are limited to that State.
The unbound input form (LabelsParam) has field FindLabels
with control source:
SELECT DISTINCT IIf([AddressFlag]=1,UCase
([StateOrProvince1]),UCase([StateOrProvince2])) AS State
FROM Contacts;
The Query:
SELECT Nz(c1.NickName,c1.FirstName) & " " & c1.LastName
AS [Member Name], (SELECT Nz(c2.[NickName],c2.
[FirstName]) & " " & c2.[LastName] AS [SONm] FROM
Contacts c2 WHERE c2.ContactID = Nz
(c1.SignificantOtherID,-9999)) AS [SO Name], Nz
(c1.CompanyName," ") AS [Company Name], Nz
(c1.ContactNickName,c1.ContactFirstName) & " " &
c1.ContactLastName AS ContactName, IIf([AddressFlag]
=1,c1.MailingAddress1
& ", "+c1.OptAddress1,c1.MailingAddress2
& ", "+c1.OptAddress2) AS Address, IIf([AddressFlag]
=1,c1.City1,c1.City2) AS City, IIf([AddressFlag]=1,UCase
(c1.StateOrProvince1),UCase(c1.StateOrProvince2)) AS
State, IIf([AddressFlag]=1,c1.PostalCode1,c1.PostalCode2)
AS PostalCode, c1.SignificantOtherID, c1.Member
FROM Contacts AS c1
WHERE (((c1.SignificantOtherID)>[c1].[ContactID]) AND
((IIf([AddressFlag]=1,UCase([c1].[StateOrProvince1]),UCase
([c1].[StateOrProvince2])))=[Forms]![LabelsParam]!
[FindLabels])) OR (((c1.SignificantOtherID) Is Null) AND
((c1.Member)=Yes));
The query is returning all members = yes, regardless of
their State. Any suggestions about what I'm doing
incorrectly? Thanks.
I've modified the query and can't figure out why it is no
longer being limited by the parameter. The user selects
the State and mailing labels are limited to that State.
The unbound input form (LabelsParam) has field FindLabels
with control source:
SELECT DISTINCT IIf([AddressFlag]=1,UCase
([StateOrProvince1]),UCase([StateOrProvince2])) AS State
FROM Contacts;
The Query:
SELECT Nz(c1.NickName,c1.FirstName) & " " & c1.LastName
AS [Member Name], (SELECT Nz(c2.[NickName],c2.
[FirstName]) & " " & c2.[LastName] AS [SONm] FROM
Contacts c2 WHERE c2.ContactID = Nz
(c1.SignificantOtherID,-9999)) AS [SO Name], Nz
(c1.CompanyName," ") AS [Company Name], Nz
(c1.ContactNickName,c1.ContactFirstName) & " " &
c1.ContactLastName AS ContactName, IIf([AddressFlag]
=1,c1.MailingAddress1
& ", "+c1.OptAddress1,c1.MailingAddress2
& ", "+c1.OptAddress2) AS Address, IIf([AddressFlag]
=1,c1.City1,c1.City2) AS City, IIf([AddressFlag]=1,UCase
(c1.StateOrProvince1),UCase(c1.StateOrProvince2)) AS
State, IIf([AddressFlag]=1,c1.PostalCode1,c1.PostalCode2)
AS PostalCode, c1.SignificantOtherID, c1.Member
FROM Contacts AS c1
WHERE (((c1.SignificantOtherID)>[c1].[ContactID]) AND
((IIf([AddressFlag]=1,UCase([c1].[StateOrProvince1]),UCase
([c1].[StateOrProvince2])))=[Forms]![LabelsParam]!
[FindLabels])) OR (((c1.SignificantOtherID) Is Null) AND
((c1.Member)=Yes));
The query is returning all members = yes, regardless of
their State. Any suggestions about what I'm doing
incorrectly? Thanks.