Hi Karl here is the SQL for the query behind the report. The IIF statement
appears on a control on the report.
SELECT tblindividual.txtfirstname, tblindividual.txtsurname,
tblindividual.txtbusinessname, tblindividual.txtbusaddress1,
tblindividual.txtbusaddress2, tblindividual.txtbusaddress3,
tblindividual.txtbusaddress4, tblindividual.txtbuscity,
tblindividual.txtbuscounty, tblindividual.txtbuspostcode,
tblindividual.txtcategory, tblFees.txtmemnbr, tblFees.txtfee,
tblFees.txtfeedatepaid, tblLevy.txtmemnbr, tblLevy.txtlevy,
tblLevy.txtpaidbybusiness, tblLevy.txtlevydatepaid, tblLevy.txtnotes,
tblLevy.txtwritnbr
FROM (tblLevy RIGHT JOIN tblindividual ON tblLevy.txtmemnbr =
tblindividual.txtmemnumber) RIGHT JOIN tblFees ON tblindividual.txtmemnumber
= tblFees.txtmemnbr
WHERE (((tblFees.txtfeedatepaid) Between
[Forms]![frmdateslevyfees]![txtfrom] And [Forms]![frmdateslevyfees]![txtto]))
OR (((tblLevy.txtlevydatepaid) Between [Forms]![frmdateslevyfees]![txtfrom]
And [Forms]![frmdateslevyfees]![txtto]));
Hope that helps?
Tony
KARL DEWEY said:
Post the complete query SQL.
--
KARL DEWEY
Build a little - Test a little
:
Hi Karl I've checked this is the IIF Statement copied and pasted into this
message
=IIf([tblLevy].[txtmemnbr] Is
Null,[tblfees].[txtmemnbr],[tblLevy].[txtmemnbr])
It looks OK to me?
Thanks
Tony
:
If you made a typo in posting maybe you also made one in the query. Check to
see if you typed a comma where you should have a period - only one key over.
--
KARL DEWEY
Build a little - Test a little
:
Sorry John that was a typo here is the correct IIf statement
=IIf([tblLevy].[txtmemnbr] Is
Null,[tblfees].[txtmemnbr],[tblLevy].[txtmemnbr])
Thanks
Tony
:
Not according to what you posted. You have different names in what you posted.
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Tony Williams wrote:
Yes Allen, that is why I included the table name. Both tables have the same
field called txtmemnbr
Tony
:
Omit the table name, Tony:
=IIf([txtmemnbr] Is Null,[txttemnbr],[txtmemnbr])
The report knows the field by its name only (unless you have 2 fields with
the same name, from different tables.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
I have a report which is based on a query. The query has 2 tables tblFees
and
tblLevy. One of the controls has an IIf statement as its control source.
This
is it:
=IIf([tblLevy].[txtmemnbr] Is
Null,[tblfees].[txttemnbr],[tblLevy].[txtmemnbr])
However when I run the report I get a prompt for "tblLevy"
What is wrong with my IIf statement?
Thanks
Tony