Blank field problem?

bissonette

Registered User.
Local time
Today, 04:05
Joined
Jun 29, 2004
Messages
22
I am using the following code for a blank field problems i was having and I get a run time error and the debugger goes to line "If IsNull(ctl.Value) Then" and says something is wrong with it. Any suggestions????

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim ctl As Control
Dim blnNoPrint As Boolean
For Each ctl In Me.Controls
If ctl.Tag = "CheckIt" Then
If IsNull(ctl.Value) Then
blnNoPrint = True
Exit For
End If
End If
Next

If blnNoPrint Then
Me.MoveLayout = False
Me.PrintSection = False
Else
Me.PrintSection = True
End If
End Sub
 
Hi,
Maybe some of your controls don't support the 'Value' method?
If you are looking at validating text boxes then decare ctl as type textbox.

Regards,
Patrick
 
Why not just use the CanGrow/Shrink on the property sheet?
 
I cant use the shrink/grow option because it leaves the lable behind. Is there a way to change that?
 
But if i re-attach the label to the control it will print on every record whether it has a data field or not.

____________
Date:
12/12/03
____________

Date:

____________

Date:
2/23/04
____________

And it will look like this. Is there a way to make a label attach if there is only data????
 
Here's another option
Dim ctrl As Control
For Each ctrl In Me.Controls
If IsNull(ctrl) Then
ctrl.Visible = False
Else
ctrl.Visible = True
End If
Next
Set ctrl = Nothing
End Sub
 

Users who are viewing this thread

Back
Top Bottom