Hi everyone,
I struct with some logical calculations in coding, i have 5 fields on my report and their is 5 year selection so each iif condition should show result based on the year value.
for example
if txtYears equal to 1 than result should visible only [1 filed] and remaining 4 fields should be invisible on the report
if txtYears equal to 2.5 then result should visible [1 field] [2 field] [3 field] because its greater than 2 and the remaining 2 fields should be invisible.
by this way any number of txtYears should visible the fields based on value of txtYears.
I did some coding on report Onload event but only first condition is working not all.
I struct with some logical calculations in coding, i have 5 fields on my report and their is 5 year selection so each iif condition should show result based on the year value.
for example
if txtYears equal to 1 than result should visible only [1 filed] and remaining 4 fields should be invisible on the report
if txtYears equal to 2.5 then result should visible [1 field] [2 field] [3 field] because its greater than 2 and the remaining 2 fields should be invisible.
by this way any number of txtYears should visible the fields based on value of txtYears.
I did some coding on report Onload event but only first condition is working not all.
Code:
Private Sub Report_Load()
If Me.Years <= 1 Then
me.field-1.visible=true
else
me.field-2.visible=false
me.field-3.visible=false
me.field-4.visible=false
me.field-5.visible=false
end if
If Me.Years > 1 <= 2 Then
me.field-1.visible=true
me.field-2.visible=true
else
me.field-3.visible=False
me.field-4.visible=false
me.field-5.visible=false
end if
exit sub