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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I tell a report to "skip" a field if it's NULL? 1

Status
Not open for further replies.

Tomin

Technical User
Dec 1, 2000
17
US
I've got a report I'm working on that has been driving me nuts. What I'm doing is putting together a phone book. There's essentially 3 fields, name, address, and phone number. I've put together the report with the fields so that they look like a printed phone book, however, when there is no address it prints a blank line. I want to tell the report to skip that field (not leaving a blank line) and move onto the next record rather than leave a blank space. Any thoughts??

Now, I can forsee my next problem being that if there's no address, I want to include the phone number on the same line as the name, and if there is an address, to keep the phone number on the same line. Is there any way to 'move' a field based on that type of criteria? Is there some kind of IIF statement I can use or something?

I truly appreciate any input, think this is going to drive me crazy :)

Tomin
 
you might consider testing the value during the Detail's OnFormat Event. This example uses one TextBox (txtData) with CanGrow and CanShrink set to Yes, and the Detail's CanGrow CanShrink set to yes. It also uses 3 TextBoxes with their visible property set to False ( 1 for each field).

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me![Address]) Or Me![Address] = "" Or Me![Address] = " " Then
txtData = Me![Name] & Space(1) & Me![Phone]
Else
txtData = Me![Name] & vbCrLf & Me![Phone] & vbCrLf & Me![Address]
End If
End Sub


PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top