How to disable specific fields in a report

AccessDeano

Trying not to be a newbie
Local time
Today, 14:00
Joined
Aug 29, 2003
Messages
30
I have looked at threads using Private Sub Detail_Format which I believe I need, however I am confused.

I have a report, which is derived from a cross tab query.

The report has 10 questions in it. 9 questions have 4 possible answers and the last question has 2 possible answers.

Therefore my report has 4 columns showing the number of responses to the 4 possible answers to each question.

However, question 10 is a straight yes or no.

I need to show question 10 differently in my report.

I think I need to disable 2 of the boxes, which currently show 0 for question 10, however I am not sure how I show the code to disable a field when the answer to question 10 only = zero for 2 of the fields.

Does any of this make sense?

Thanks
 
Reports aren't interactive so there's no point in disabling a field, you can however toggle it's Visible property
Me.SomeControl.Visible = Not IsNull(Me.SomeControl)
 
Thanks for the response.

I have tried:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.QuestionID = "How satisfied would you be to RECOMMEND ******* Garages?" Then
If Me.[1] = 0 Then
Me.[1].Visible = False
Else
Me.[1].Visible = True
End If
End If
End Sub

But I lose the response for field [1] to all 10 questions.

Am I just going about this the wrong way or is there an easy answer?
 
OK, I renamed the Text Boxes on the report and amended the code to:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Question = "How satisfied would you be to RECOMMEND Wessex Garages?" Then
If Me.[CS] = 0 Then
Me.[CS].Visible = False
Else
Me.[CS].Visible = True
End If
End If
End Sub

But I still get the same result, the first column in disabled for every question.

Any ideas?
 
Rich, Thank you for your help with this issue but I have sorted it.

It appears my If statement within another If statemnet was the problem. I re wrote the code as :

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Question = "How satisfied would you be to RECOMMEND Wessex Garages?" And Me.[CS] = 0 Then
Me.[CS].Visible = False
Else
Me.[CS].Visible = True
End If
End Sub

and it works correctly.

Thank you very much for your input, it was most helpful.
 

Users who are viewing this thread

Back
Top Bottom