I have a main form with an option group that allows users to choose one of 5 options (although this may increase). The forms also has 5 hidden subforms and depending on which one of the 5 choices options are chosen, then one of five sub forms will be made visible.
In order to do this, I think that the code must make all subforms visible = false and then open up the correct subform, every time the option group is updated. I am pretty much there, by using the following code on the After Update event of the option group. This iterates through all subforms(with a trailing number between 1 and 5) and sets them visible = false. This works 100%
Dim i As Integer
For i = 1 To 5
Me("sfrmRSLpis" & i).Visible = False
Next i
However, now the part I cant get right - depending on the choice made in optiongroup, I want to set the relevant sfrm visible = true.
I have tried the following code, but it Access doesnt seem to like it and it cant seem to pick up the option value chosen in the option group:
Dim i As Integer
Dim f As Integer
Me.Framepis.Value = f
For i = 1 To 5
Me("sfrmRSLpis" & i).Visible = False
Next i
Me("sfrmRSLpis" & f).Visible = True
Any help much appreciated!
In order to do this, I think that the code must make all subforms visible = false and then open up the correct subform, every time the option group is updated. I am pretty much there, by using the following code on the After Update event of the option group. This iterates through all subforms(with a trailing number between 1 and 5) and sets them visible = false. This works 100%
Dim i As Integer
For i = 1 To 5
Me("sfrmRSLpis" & i).Visible = False
Next i
However, now the part I cant get right - depending on the choice made in optiongroup, I want to set the relevant sfrm visible = true.
I have tried the following code, but it Access doesnt seem to like it and it cant seem to pick up the option value chosen in the option group:
Dim i As Integer
Dim f As Integer
Me.Framepis.Value = f
For i = 1 To 5
Me("sfrmRSLpis" & i).Visible = False
Next i
Me("sfrmRSLpis" & f).Visible = True
Any help much appreciated!