In the present, we have to use two reports, which come from the same source (table) because one field controls it. This is the scenario
Field name = USA; Value = "Yes" or "No"
Let's say the table has many fields, A, B, C, D, E, F, G, H, I, J and USA.
Report1 consists of the following fields: A, B, C, D, E, G, H, J and USA. (no F and I)
Report2 consists of the folllowing fields; A, B, C, D, F, G, I, J and USA. (no E and H)
In the present, if the USA = "Yes", Report1 will be printed. Otherwise, Report2 will be printed.
The report looks very similar, except for the fields that I mentioned.
In order to create an efficiency, the management would like to combine them into one report. I am unsure whether I can hide the fields based on the condition. So, when the record states that USA = NO, field F will be replaced with Field E and Field I will be replaced with Field H.
The reason is, the management DOES NOT want a sorting order by Yes or No in the USA field. They would like just to print the record from the first in the table to the last.
I tried to use the code below and came up with an error. I would like to do just one field first.
Error message = Compile error: Method or data member not found.
I put the code in the Details line.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.txtE.Visible = (Me.txtUSA="Yes")
Me.txtF.Visible = (Me.txtUSA="No")
'Try to experiment with one field first.
'txtE, txtF, txtUSA are all bounded fields.
End Sub
What did I forget here?? If the code is incorrect, please correct it for me. Thanks.
Field name = USA; Value = "Yes" or "No"
Let's say the table has many fields, A, B, C, D, E, F, G, H, I, J and USA.
Report1 consists of the following fields: A, B, C, D, E, G, H, J and USA. (no F and I)
Report2 consists of the folllowing fields; A, B, C, D, F, G, I, J and USA. (no E and H)
In the present, if the USA = "Yes", Report1 will be printed. Otherwise, Report2 will be printed.
The report looks very similar, except for the fields that I mentioned.
In order to create an efficiency, the management would like to combine them into one report. I am unsure whether I can hide the fields based on the condition. So, when the record states that USA = NO, field F will be replaced with Field E and Field I will be replaced with Field H.
The reason is, the management DOES NOT want a sorting order by Yes or No in the USA field. They would like just to print the record from the first in the table to the last.
I tried to use the code below and came up with an error. I would like to do just one field first.
Error message = Compile error: Method or data member not found.
I put the code in the Details line.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.txtE.Visible = (Me.txtUSA="Yes")
Me.txtF.Visible = (Me.txtUSA="No")
'Try to experiment with one field first.
'txtE, txtF, txtUSA are all bounded fields.
End Sub
What did I forget here?? If the code is incorrect, please correct it for me. Thanks.