wiklendt
i recommend chocolate
- Local time
- Tomorrow, 07:38
- Joined
- Mar 10, 2008
- Messages
- 1,746
i am developing this code, and getting the error
highlighting the "Else" where i have it in red in the code below. i have counted all my if's, then's, else's and end if's... i can't see the problem? can anyone else? (oh, and if anyone can see that this code is doomed to fail in other ways, let me know!)compile error: else without if
Code:
[COLOR=Blue]Private Sub[/COLOR] Detail_Format(Cancel [COLOR=Blue]As Integer[/COLOR], FormatCount [COLOR=Blue]As Integer[/COLOR])
[COLOR=Blue]Dim [/COLOR]sct [COLOR=Blue]As [/COLOR]Section
[COLOR=SeaGreen]' first check whether the form with the checkbox is open[/COLOR]
[COLOR=Blue]If [/COLOR]Forms!frmLISTS.IsLoaded = True [COLOR=Blue]Then[/COLOR]
[COLOR=SeaGreen]
' check whether checkbox on frmLISTS is true or false[/COLOR]
[COLOR=Blue]If [/COLOR]Forms!frmLISTS.chkReportDetails = [COLOR=Blue]False Then[/COLOR] [COLOR=SeaGreen]' details not checked[/COLOR]
[COLOR=SeaGreen] ' user wants no details
' select all sections with tag "UserDetails" and make invisible[/COLOR]
[COLOR=Blue]For Each [/COLOR]sct [COLOR=Blue]In [/COLOR]Me
[COLOR=Blue]If [/COLOR]sct.Tag = "UserDetails" [COLOR=Blue]Then[/COLOR]
sct.Visible = [COLOR=Blue]False[/COLOR]
[COLOR=Blue] End If[/COLOR]
[COLOR=Red] Else[COLOR=Black] [COLOR=SeaGreen]' details checked, show all sections[/COLOR][/COLOR][/COLOR]
[COLOR=Blue] For Each[/COLOR] sct [COLOR=Blue]In [/COLOR]Me
[COLOR=Blue]If [/COLOR]sct.Tag = "UserDetails" [COLOR=Blue]Then[/COLOR]
sct.Visible = [COLOR=Blue]True[/COLOR]
[COLOR=Blue] End If[/COLOR]
[COLOR=Blue] End If[/COLOR]
[COLOR=Blue]Else[/COLOR][COLOR=SeaGreen]' checkbox unavailable, show all sections as default[/COLOR]
[COLOR=Blue]For Each[/COLOR] sct [COLOR=Blue]In [/COLOR]Me
[COLOR=Blue]If [/COLOR]sct.Tag = "UserDetails" [COLOR=Blue]Then[/COLOR]
sct.Visible = [COLOR=Blue]True[/COLOR]
[COLOR=Blue] End If
End If[/COLOR]
[COLOR=Blue]End Sub[/COLOR]