Duane,
Sorry. Here is the code I utilized, including the capitalized "If":
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [purchase_order_id] = "" Then
Detail.Visible = False
Else
Detail.Visible = True
End If
End Sub
Also, I did try the code that you mentioned as such:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = ( Trim(Me.Purchase_Order_ID & "") = "")
End Sub
Got the same result.
Thanks again.
Duane Hookom said:
I am confused by 2 things:
1) why isn't "if ..." in uppercase? Seems to me, this should be "If ...".
Are you translating from a non-English language?
2) why not use the code that I suggested?
--
Duane Hookom
Microsoft Access MVP
Alberto said:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
if me.[purchase_order_id] = "" Then
Detail.Visible = False
Else
Detail.Visible = True
End Sub
:
Could you please copy the entire code from the module and paste it into the
reply? We can't confirm what event fires the code and you are clearly missing
lines.
You might want to try:
Cancel = ( Trim(Me.Purchase_Order_ID & "") = "")
--
Duane Hookom
Microsoft Access MVP
:
Duane,
Thanks for the response. I tried it but it did not work. I have to assume
that it is because the field is not null. Yet when I pull up the crosstab
query that the report is based on, most of the fields [purchase_order_id] are
empty. I also tried the following to no avail:
if me.[purchase_order_id] = "" Then
Detail.Visible = False
Else
Detail.Visible = True
Any other ideas that I can try?
:
Are you really sure the Purchase_order_ID is null? Is this bound to a control?
I would try:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = IsNull(Me.[purchase_order_id])
End Sub
--
Duane Hookom
Microsoft Access MVP
:
What am I doing wrong? I want to hide a section when there is no purchase
order [purchase_order_id] associated with a given product model
[product_model]. I have the record [purchase_order_id] in the detail section
and I want to hide each detail section when there is no purchase order id. I
am using the following code on the "On Format" expression of the Detail
Section:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull([purchase_order_id]) Then
Detail.Visible = False
Else
Detail.Visible = True
End If
End Sub
But for some reason, the section always appears. Any ideas?