There are 2 problems in the Report...
- Data of some Records does not appear
- Data of Office address appear one line below from where Residence address appears i.e. the Tops of Residence & Office are not same during runtime. It is properly set during design time
The
CounselMaster holds the counselIDs and other info.
There is Table called CounselAddress which stores
counselId
addressLine1
addressLine3
addressLine4
addressType
preferred
cityId
There is table called CityMaster which reads the cityID from the cityID found in the CounselAddress
There is yet another Table counselPhones
which stores
CounselID
phone
phoneType
preferred
CounselMaster is linked to counselAddress & counselPhone (INNER JOINS)
The query2 which retrieves the data from these tables is....
Code:
SELECT CityMaster.cityName, IIf(CounselMaster!fName<>'',CounselMaster!fName & IIf(CounselMaster!mName<>'',' ' & CounselMaster!mName,'') & IIf(CounselMaster!lName<>'',' ' & CounselMaster!lName,''),'N.A.') AS counselName, CounselAddress.addressLine1, CounselAddress.addressLine2, CounselAddress.addressLine3, CounselAddress.addressLine4, CounselAddress.addressType, CounselAddress.preferred, CounselAddress.PIN, CounselPhones.phone, CounselPhones.phoneType, CounselPhones.preferred
FROM CounselPhones INNER JOIN ((CounselMaster INNER JOIN CounselAddress ON CounselMaster.counselID = CounselAddress.counselID) INNER JOIN CityMaster ON CounselAddress.cityID = CityMaster.cityID) ON CounselPhones.counselID = CounselMaster.counselID
WHERE (((CounselMaster.inPanel)=Yes))
ORDER BY CityMaster.cityName, IIf(CounselMaster!fName<>'',CounselMaster!fName & IIf(CounselMaster!mName<>'',' ' & CounselMaster!mName,'') & IIf(CounselMaster!lName<>'',' ' & CounselMaster!lName,''),'N.A.');
In the CR I have added two address fields as below...
Code:
//Formula Field - AddressOffice
if {Query2.addressType}= "OFFICE/WORK" then
if {Query2.addressLine1}<>"" then
{Query2.addressLine1}
& if {Query2.addressLine2}<>"" then
chr(10)& chr(13) & {Query2.addressLine2}
& if {Query2.addressLine3}<>"" then
chr(10)& chr(13) & {Query2.addressLine3}
else ''
else ''
else ''
else
''
;
Code:
//Formula Field - AddressOffice
if {Query2.addressType}= "RESIDENCE" then
if {Query2.addressLine1}<>"" then
{Query2.addressLine1}
& if {Query2.addressLine2}<>"" then
chr(10)& chr(13) & {Query2.addressLine2}
& if {Query2.addressLine3}<>"" then
chr(10)& chr(13) & {Query2.addressLine3}
else ''
else ''
else ''
else
''
;
Grouping (in Report) is done 1st by cityName and then by counselName(which is Hidden) of Query2.
Now when the report is printed, for some records the address comes out (i.e not printed) empty though in the query2 the data is populated. eg under the city Name Bathinda chirangi lal garg & Gopal Chand Gupta no info comes in the report (there could be more such records).
Now for Jai gopal Goyal the office address is printed after residence is printed (i.e) they are not on the same Line). no idea what's happening.
Iam attaching the db & report.
Could somebody let me know what is wrong!!!!!!
Thankz in advance......