Foxtable(狐表)用户栏目专家坐堂 → if 语句总提示“应为语句结束”


  共有8726人关注过本帖树形打印复制链接

主题:if 语句总提示“应为语句结束”

帅哥哟,离线,有人找我吗?
zpx_2012
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:976 积分:8521 威望:0 精华:0 注册:2012/2/9 16:35:00
if 语句总提示“应为语句结束”  发帖心情 Post By:2012/8/22 23:08:00 [显示全部帖子]

各位老师,下面的语句哪里有问题,确定时总提示“应为语句结束”

If _UserName <> "开发者" Then
        For Each dr1 As DataRow In DataTables("授权表").Select("部门 = '" & _UserGroup & "' And 角色 In ('" & _UserRole & "')")
            If dr1.IsNull("可查看列") Then
                Tables(dr1("表名")).Visible = False
                Tables(dr1("表名")).AllowEdit = False
            ElseIf dr1.IsNull("可编辑列") Then
                Tables(dr1("表名")).AllowEdit = False
            Else
                For Each c As Col In dr1("表名").Cols
                    If c.name In (dr1("可查看列")) Then
                        c.Visible = True
                    ElseIf c.name In dr1(("可编辑列")) Then
                        c.AllowEdit = True
                    End If
                Next
            End If
        Next
 End If


 


此主题相关图片如下:qq截图20120822230601.jpg
按此在新窗口浏览图片

 回到顶部
帅哥哟,离线,有人找我吗?
zpx_2012
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:976 积分:8521 威望:0 精华:0 注册:2012/2/9 16:35:00
  发帖心情 Post By:2012/8/23 0:35:00 [显示全部帖子]

谢谢各位的回复,还是不行,可能不能用"in"做判断,后来只好把代码改成下面,麻烦了一些,但是可以了,跟大家分享一下,不知道狐爸有什么好办法?

If _UserName <> "开发者" Then
        For Each dr1 As DataRow In DataTables("授权表").Select("部门 = '" & _UserGroup & "' And 角色 In ('" & _UserRole & "')")
            If dr1.IsNull("可查看列") Then
                Tables(dr1("表名")).Visible = False
                Tables(dr1("表名")).AllowEdit = False
            ElseIf dr1.IsNull("可编辑列") Then
                Tables(dr1("表名")).AllowEdit = False
            Else
                For Each tb As Table In Tables
                    If tb.name = dr1("表名") Then
                        For Each c As Col In tb.Cols
                            Dim a As String = c.name
                            If dr1("可查看列").contains(a) Then
                                c.Visible = True
                            ElseIf dr1("可编辑列").contains(a) Then
                                c.AllowEdit = True
                            Else
                                c.Visible = False
                                c.AllowEdit = False
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End If


 回到顶部