Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Don't want to skip space on report if there is no data in a field

Status
Not open for further replies.

pbsandrad

Technical User
Mar 22, 2005
6
US
I am creating an auto dealer association member roster. My report is coming from two tables: Members and MemberContacts

I want to list members and contact names as follows:

[DealershipName]
[Address]
[City], [St] [Zip]

Owner: [OwnerFN] [OwnerLN]
Service Manager: [SvMgrFN][SvMgrLN]
Cashier: [CashierFN] [CashierLN]

If there is no data in a contact field (i.e. no Service Manager listed in my table) how can I make the report print only the fields that contain data.

So I would want the above to look like this:

[DealershipName]
[Address]
[City], [St] [Zip]

Owner: [OwnerFN] [OwnerLN]
Cashier: [CashierFN] [CashierLN]

Without skipping a line between Owner and Cashier.

My knowledge is pretty limited and would appreciate any help on this. Thank you

 
You might try putting an unbound text field on the report and set the CanGrow property to True. In the OnFormat event of the Details section, do something like this:
Code:
    Dim strTemp as string

    strTemp = vbNullString

    If (Not isnull(OwnerFN)) or (not isnull(OwnerLN)) then strTemp = "Owner: " & Nz(OwnerFn,vbNullString) & " " & Nz(OwnerLN,vbNullString)

    If (Not isnull(SvMgrFN)) or (not isnull(svMgrLN)) then strTemp = strTemp & vbcrlf & "Service Manager: " & Nz(SvMgrFn,vbNullString) & " " & Nz(SvMgrLN,vbNullString)

    If (Not isnull(CashierFN)) or (not isnull(CashierLN)) then strTemp = strTemp & vbcrlf & "Cashier: " & Nz(CashierFn,vbNullString) & " " & Nz(CashierLN,vbNullString)

    If (Left(strTemp,2) = vbcrlf) then strTemp = mid(strTemp,3)

    YourUnboundControl.Value = strTemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top