Foxtable(狐表)用户栏目专家坐堂 → 窗口代码问题


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

主题:窗口代码问题

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


加好友 发短信
等级:三尾狐 帖子:790 积分:5695 威望:0 精华:0 注册:2009/4/17 18:42:00
窗口代码问题  发帖心情 Post By:2010/10/8 17:37:00 [显示全部帖子]

请问我在点击主表目录树节点时,出现如下错误提示:

 


图片点击可在新窗口打开查看此主题相关图片如下:未命名.gif
图片点击可在新窗口打开查看

窗口控件姓名和年月都是绑定到主表列,控件ValueChanged代码如下:

Dim Filter As String
With e.Form.Controls("姓名")
    If .Value IsNot Nothing Then
        Filter = "姓名 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("年月")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "年月 = '" & .Value & "'"
    End If
End With
Dim dd As WinForm.TextBox = e.Form.Controls("年月")
Dim dd1 As WinForm.TextBox = e.Form.Controls("姓名")
Dim Filter1 As String
With e.Form.Controls("姓名")
    If .Value IsNot Nothing Then
        Filter1 = "姓名 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("年月")
    If .Value IsNot Nothing Then
        If dd1 IsNot Nothing Then
            Dim d1 As Date = DataTables("主管考勤").Compute("min(日期)", "[姓名] = '" & dd1.text & "' And [年月] = '" & dd.text & "' ")
            Dim dr As DataRow = DataTables("主管考勤").Find("[姓名] = '" & dd1.text & "' and [日期] =  #" & d1.AddDays(-10) & "# ")
            If dr IsNot Nothing Then
                If Filter1 > "" Then
                    Filter1 = Filter1 & " And "
                End If
                Filter1 = Filter1 & "年月 = '" & dr("年月") & "'"
            End If
        End If
    End If
End With

If Filter > "" Then
    Tables("主管考勤月统计查询_Table1").Filter = Filter
End If
If Filter1 > "" Then
    Tables("主管考勤月统计查询_Table2").Filter = Filter1
End If
Tables("主管考勤月统计查询_Table1").Sort = "日期" '排序
Tables("主管考勤月统计查询_Table2").Sort = "日期" '排序


 


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


加好友 发短信
等级:三尾狐 帖子:790 积分:5695 威望:0 精华:0 注册:2009/4/17 18:42:00
  发帖心情 Post By:2010/10/8 18:00:00 [显示全部帖子]

奇怪,我把代码改成如下,没有提示:

Dim Filter As String
With e.Form.Controls("姓名")
    If .Value IsNot Nothing Then
        Filter = "姓名 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("年月")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "年月 = '" & .Value & "'"
    End If
End With
If Filter > "" Then
    Tables("主管考勤月统计查询_Table1").Filter = Filter
End If
Tables("主管考勤月统计查询_Table1").Sort = "日期" '排序
Dim dd As WinForm.TextBox = e.Form.Controls("年月")
Dim dd1 As WinForm.TextBox = e.Form.Controls("姓名")
Dim Filter1 As String
With e.Form.Controls("姓名")
    If .Value IsNot Nothing Then
        Filter1 = "姓名 = '" & .Value & "'"
    Else
        Return
    End If
End With
With e.Form.Controls("年月")
    If .Value IsNot Nothing Then
        If Filter1 > "" Then
            Dim d1 As Date = DataTables("主管考勤").Compute("min(日期)", "[姓名] = '" & dd1.text & "' And [年月] = '" & dd.text & "' ")
            Dim dr As DataRow = DataTables("主管考勤").Find("[姓名] = '" & dd1.text & "' and [日期] =  #" & d1.AddDays(-10) & "# ")
            If dr IsNot Nothing Then
                Filter1 = Filter1 & " And "
            Else
                Return
            End If
            Filter1 = Filter1 & "年月 = '" & dr("年月") & "'"
        Else
            Return
        End If
    Else
        Return
    End If
End With


'If Filter1 > "" Then
'    Filter1 = Filter1 & " And "
'End If
'Filter1 = Filter1 & " 日期 >= #" & d1.AddDays(-6) & "# and 日期 <= #" & d1.AddDays(-1) & "#    "

If Filter1 > "" Then
    Tables("主管考勤月统计查询_Table2").Filter = Filter1
End If
Tables("主管考勤月统计查询_Table2").Sort = "日期" '排序


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


加好友 发短信
等级:三尾狐 帖子:790 积分:5695 威望:0 精华:0 注册:2009/4/17 18:42:00
  发帖心情 Post By:2010/10/8 22:31:00 [显示全部帖子]

没看出问题,还请C版指点,谢谢

 回到顶部