Hiding Section Detail


A

Alberto

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?
 
Ad

Advertisements

D

Duane Hookom

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
 
A

Alberto

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?




Duane Hookom said:
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


Alberto said:
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?
 
D

Duane Hookom

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


Alberto said:
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?




Duane Hookom said:
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


Alberto said:
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?
 
A

Alberto

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





Duane Hookom said:
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


Alberto said:
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?




Duane Hookom said:
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?
 
D

Duane Hookom

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





Duane Hookom said:
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


Alberto said:
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?
 
Ad

Advertisements

A

Alberto

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





Duane Hookom said:
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?
 
Ad

Advertisements

D

Duane Hookom

Again, if you would have copied and pasted the code, it should have closed up
all the un-necessary spaces that I had included in my suggestion.

Try add this code to get the values listed in the immediate/debug windo:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = (Trim(Me.Purchase_Order_ID & "")= "")
Debug.Print "Me.Purchase_Order_ID: " & Me.Purchase_Order_ID
End Sub

After the report has run, press Ctrl+G to see the results

--
Duane Hookom
Microsoft Access MVP


Alberto said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top