I have a report "rptAddresses" to printout static data in the query
"qryAddresses". The qryAddresses consists of 5 tables viz:
1/ tblPeople (The names only of all people & companies.)
2/ tblPeopleType (Customer/Supplier/Contractor/Personal etc.)
3/ tblPeople_1 (The alias of tblPeople, used for the address
names so that the one table can be used for people & address names.)
4/ tblAddressType
(Account/delivery/head-office/home/work/freight/FOB/FIS/pickup etc).
5/ tblAddressDetails (containing all the static address details
with phone/fax/www etc. Together with, respectively, PeopleID, PeopleTypeID,
AddressNameID, AddressTypeID, and of course AddessesID for
tblAddressDetails.)
I only ever use the query design grid, but here is Access's display of the
equivalent SQL for qryAddresses:
SELECT AddressDetail.AddressesID, AddressDetail.PeopleID, People.People,
AddressDetail.PeopleTypeID, PeopleType.PeopleType, AddressDetail.AddrNameID,
People_1.People, AddressDetail.AddrTypeID, AddressType.AddressType,
AddressDetail.Address1, AddressDetail.Address2, AddressDetail.City,
AddressDetail.PostCode, AddressDetail.Country, AddressDetail.StreetDir,
AddressDetail.Telephone, AddressDetail.Fax, AddressDetail.Mobile,
AddressDetail.email, AddressDetail.www, AddressDetail.ShortName,
AddressDetail.Bank, AddressDetail.Comments, AddressDetail.ABN,
AddressDetail.PriceListMemo, AddressDetail.Contact1, AddressDetail.Contact2,
AddressDetail.Contact3, AddressDetail.Date
FROM PeopleType INNER JOIN (People INNER JOIN (AddressType INNER JOIN
(AddressDetail INNER JOIN People AS People_1 ON AddressDetail.AddrNameID =
People_1.PeopleID) ON AddressType.AddrTypeID = AddressDetail.AddrTypeID) ON
People.PeopleID = AddressDetail.PeopleID) ON PeopleType.PeopleTypeID =
AddressDetail.PeopleTypeID
ORDER BY People.People;
The rptAddresses is based on the qryAddesses and contains the following
fields:
People.People (The person/company name)
People.People_1 (The address name)
Address1
Address2
City
PostCode
Telephone
Fax
Etc
My problem is to suppress the printing of "People.People_1" when this is the
same as "People.People", which is most of the time.
I thought of some code such as:
If
AcCompare People.People = People.People-1
Then People.People_1.visible = false
EndIf
Which does not work.
And this is the problem.