Report Text box Control (2 Viewers)

deehutchins

Registered User.
Local time
Today, 13:01
Joined
May 30, 2014
Messages
49
Good morning,
I am currently working on a project that is almost complete, but my only problem is that I am clueless as to how I can get a text box in my report to hide base on if a text box in my form is hidden. Meaning that whenever this particular text box in my form is hidden then the text box on my report should be hidden too. Can someone please guide me through the process of how to get my form and report text boxes in sync with each other.

Thanks in advance.
 

bob fitz

AWF VIP
Local time
Today, 21:01
Joined
May 23, 2011
Messages
4,726
Good morning,
I am currently working on a project that is almost complete, but my only problem is that I am clueless as to how I can get a text box in my report to hide base on if a text box in my form is hidden. Meaning that whenever this particular text box in my form is hidden then the text box on my report should be hidden too. Can someone please guide me through the process of how to get my form and report text boxes in sync with each other.

Thanks in advance.
Is the form always open when the report is opened?
What decides if the text box is visible or not?
 

deehutchins

Registered User.
Local time
Today, 13:01
Joined
May 30, 2014
Messages
49
Yes, the form would be open when the report is genrated.
 

deehutchins

Registered User.
Local time
Today, 13:01
Joined
May 30, 2014
Messages
49
Oh sorry the form textbox visibility determines the reports textbox visibility, if the form textbox is visible then the report text box is visible and vice versa.

Thanks in advance,
 

bob fitz

AWF VIP
Local time
Today, 21:01
Joined
May 23, 2011
Messages
4,726
Oh sorry the form textbox visibility determines the reports textbox visibility, if the form textbox is visible then the report text box is visible and vice versa.

Thanks in advance,
Yes, I understand that the visibility of the report text box is determined by the visibility of the form text box but what determines the visibility of the form text box in the first place.
 

deehutchins

Registered User.
Local time
Today, 13:01
Joined
May 30, 2014
Messages
49
My apologies what determines the form textbox visibility is a combo box on the form. If the user selects quarterly on the combo box then the form textbox should be hidden, but if selected annual the form textbox is shown.

Hope this helps and thanks for your help.
 

bob fitz

AWF VIP
Local time
Today, 21:01
Joined
May 23, 2011
Messages
4,726
In the reports On Format event, try something like:
Code:
Me.ReportTextboxName.Visible = Forms!FormName.FormTextboxName.Visible
 

deehutchins

Registered User.
Local time
Today, 13:01
Joined
May 30, 2014
Messages
49
Good morning, I tried the solution provided and I got and error saying that the code could not find the form. If possible could provide a little more detail of how the code should me written like up until the part of end if. Or provide other possible codes.

Thanks.
 

bob fitz

AWF VIP
Local time
Today, 21:01
Joined
May 23, 2011
Messages
4,726
Can you tell us the name of both text boxes and the name of the form.
Please show us the exact code you tried.
 

deehutchins

Registered User.
Local time
Today, 13:01
Joined
May 30, 2014
Messages
49
Name of the form is called: KPI_frm_Findings_Recommendations
Name of the textbox in the form is called: Txt_Annual_CQM_Findings_Recommendations
Name of the report textbox is called: Annual_CQM_Findings_Recommendations
Name of the report textbox label is called: lblAnnual


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Annual_CQM_Findings_Recommendations.Visible = Forms!KPI_frm_Findings_Recommendations.Txt_Annual_CQM_Findings_Recommendations.Visible Then
Me.lblAnnual.Visible = Me.Annual_CQM_Findings_Recommendations.Visible
End If
End Sub
 

bob fitz

AWF VIP
Local time
Today, 21:01
Joined
May 23, 2011
Messages
4,726
Try this:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  Me.Annual_CQM_Findings_Recommendations.Visible = Forms!KPI_frm_Findings_Recommendations.Txt_Annual_ CQM_Findings_Recommendations.Visible
End Sub
 

bob fitz

AWF VIP
Local time
Today, 21:01
Joined
May 23, 2011
Messages
4,726
Still no luck, any more suggestions?
Sorry, I've just realised that a text box on a report doesn't have a Visible property. Would I be correct to assume that the report would be printed on white paper and that the value of the text box is printed in black?
 

deehutchins

Registered User.
Local time
Today, 13:01
Joined
May 30, 2014
Messages
49
you would be correct, the report would be printed on white paper with the value within the textbox would be black.

thanks for your help
 

bob fitz

AWF VIP
Local time
Today, 21:01
Joined
May 23, 2011
Messages
4,726
you would be correct, the report would be printed on white paper with the value within the textbox would be black.

thanks for your help
This is what I would do:
Put the code that opens the report in an If/Then statement in which you can test for the Visible property setting of the text box on the form and then put a text value in the OpenArgs parameter of the Docmd.OpenReport method.
Put an If/Then statement in the reports On Format event to evaluate the reports OpenArgs property value and then set the ForeColor property of the text box to white or black to show or hide its contents.
 

Users who are viewing this thread

Top Bottom