I suspect that your control on the form is returning the string "True" or
the string "False" instead of the value True(-1) or False(0). You might
consider using a checkbox instead of a combobox - that will return -1 or
0.
Try the following modification and see if the query runs. It is testing
the
value in ARYN and if the string value is "True" is returning a True (-1)
or
a False (0).
SELECT Contacts.[Wholesaler ID], Contacts.[Wholesaler Name],
Contacts.[Packet Sent to Wholesaler Date], Contacts.[City],
Contacts.[Product
Type], Contacts.[General Notes], Contacts.[Designated State],
Contacts.[Check
Received YN], Contacts.[Employee], Contacts.[Payment for Allocation]
FROM Contacts
WHERE Contacts.[Packet Sent to Wholesaler YN]=True AND
Contacts.[Check Received YN]=True AND
Contacts.[Agreement Received YN]=([Forms]![PSV]![ARYN] = "True")
GROUP BY Contacts.[Wholesaler ID], Contacts.[Wholesaler Name],
Contacts.[Packet Sent to Wholesaler Date], Contacts.City,
Contacts.[Product
Type], Contacts.[General Notes], Contacts.[Designated State],
Contacts.[Check
Received YN], Contacts.[AB Employee], Contacts.[Payment for Allocation];
Adam said:
An update...
When I run the report, the form loads and I return an error after
submitting
the form "Data type mismatch in criteria expression." When I try to
run
the
query on its own I return an error "Unknown."
In the "PSV" form the "ARYN" is a "value list" with "true";"false" for
the
row source. "Agreement Received YN" in "Contacts" is a "true/false"
field
as
well.
Urg... I am so stumped.
-Adam
:
Hi Ed,
Thanks for the response. When I tried Eval("[Forms]![PSV]![ARYN]") I
return
an error that says, "unknown". Any ideas?
Here is my query from the SQL view... (long, I know, sorry!)
SELECT Contacts.[Wholesaler ID], Contacts.[Wholesaler Name],
Contacts.[Packet Sent to Wholesaler Date], Contacts.[City],
Contacts.[Product
Type], Contacts.[General Notes], Contacts.[Designated State],
Contacts.[Check
Received YN], Contacts.[Employee], Contacts.[Payment for Allocation]
FROM Contacts
WHERE (((Contacts.[Packet Sent to Wholesaler YN])=True) AND
((Contacts.[Check Received YN])=True) AND ((Contacts.[Agreement
Received
YN])=Eval("[Forms]![PSV]![ARYN]")))
GROUP BY Contacts.[Wholesaler ID], Contacts.[Wholesaler Name],
Contacts.[Packet Sent to Wholesaler Date], Contacts.City,
Contacts.[Product
Type], Contacts.[General Notes], Contacts.[Designated State],
Contacts.[Check
Received YN], Contacts.[AB Employee], Contacts.[Payment for
Allocation];
:
Hi AZ,
To fix this problem just replace in you query "[Forms]![PSV]![ARYN]"
with
Eval("[Forms]![PSV]![ARYN]") and it should work.
I hope it helps
--
Regards,
Ed
:
I am having trouble with a query that keeps returning the error
message "This
expression is typed incorreclt, or it is too complex to be
evaluated." Any
help you can offer is more than appreciated as I am at a loss...
My setup is one query, one form, and one report. Ideally, the
form
loads
when the report runs, the query is populated based on the result
from
the
form, and the report displays the data. The problem is I keep
throwing an
error...
The DB Structure is as follows:
Form Name = "PSV"
Form's Field Name that Gets Passed= "ARYN"
Table Name = "Contacts"
Table Field Name = "Agreement Received" (a "true/false field")
I am trying to have the query return all results where "Agreements
Received"
= "ARYN" (Note: The "ARYN" value is either "true" or "false").
The code in the "criteria" line of the query is
"[Forms]![PSV]![ARYN]"
I have no idea how to make this work. Any ideas? I clearly need
help...
-AZ