George-Bowyer
Registered User.
- Local time
- Today, 04:57
- Joined
- Dec 21, 2012
- Messages
- 178
I have a report with a sub-report that shows an employees name and address.
If there happens not to be a relevant employee, then I have some code that searches a different table and comes up with a different address, which I load into an empty text box during the report details on format event
For some reason this leaves an empty lines if one of the address fields is empty, and I can't work out why?
I suspect it must be that my empty fields are not null (which makes sense as they have already gone through "IF NOT ISNULL" process, bt I'm not sure what to do instead...?
Can anyone tell me how I need to sort this out, please?
Thanks
George
If there happens not to be a relevant employee, then I have some code that searches a different table and comes up with a different address, which I load into an empty text box during the report details on format event
Code:
If Not RS.NoMatch Then
If Not IsNull(!fldAdd1) Then strAdd1 = !fldAdd1
If Not IsNull(!fldAdd2) Then strAdd2 = !fldAdd2
If Not IsNull(!fldAdd3) Then strAdd3 = !fldAdd3
If Not IsNull(!fldTown) Then strTown = !fldTown
If Not IsNull(!fldRegion) Then strRegion = !fldRegion
If Not IsNull(!fldPostCode) Then strPostCode = !fldPostCode
End If
End With
strNewAdd = Trim(IIf(IsNull(strAdd1), "", strAdd1 + Chr(13) & Chr(10)) + IIf(IsNull(strAdd2), "", strAdd2 + Chr(13) & Chr(10)) + IIf(IsNull(strAdd3), "", strAdd3 + Chr(13) & Chr(10)) + IIf(IsNull(strTown), "", strTown + Chr(13) & Chr(10)) + IIf(IsNull(strRegion), "", strRegion + Chr(13) & Chr(10)) + IIf(IsNull(strPostCode), "", strPostCode))
GetAddress = strNewAdd
For some reason this leaves an empty lines if one of the address fields is empty, and I can't work out why?
I suspect it must be that my empty fields are not null (which makes sense as they have already gone through "IF NOT ISNULL" process, bt I'm not sure what to do instead...?
Can anyone tell me how I need to sort this out, please?
Thanks
George