Foxtable(狐表)用户栏目专家坐堂 → 未将对象应用设置到对象的实例……求解!


  共有9016人关注过本帖平板打印复制链接

主题:未将对象应用设置到对象的实例……求解!

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


加好友 发短信
等级:一尾狐 帖子:415 积分:3598 威望:0 精华:0 注册:2016/1/1 20:20:00
未将对象应用设置到对象的实例……求解!  发帖心情 Post By:2016/3/2 22:21:00 [只看该作者]

   代码如下:

If e.DataCol.Name = "日期" Then
    If e.DataRow.IsNull("日期") Then
        e.DataRow("零售单编号") = Nothing
    Else
        Dim mn As WinForm.Form = Forms("零售录入窗口")
        If mn.Opened = True Then
            Dim mb As DataRow
            Dim mv As String = mn.Controls("Label2").Text
            Dim mc As String
            mv = mv.Trim()
            mb = DataTables("权限设置").Find("账号名 = '" & mv & "'")
            If mb IsNot Nothing Then
                mc = mb("账号编码")
                Dim bh As String = mc & "-" & Format(e.NewValue,"yyyyMMdd") & "-" '取得编号的8位前缀
                If e.DataRow("零售单编号").StartsWith(bh) = False
                    Dim max As String
                    Dim idx As Integer
                    max = e.DataTable.Compute("Max(零售单编号)","日期 = #" & e.NewValue  & "# And [_Identify] <> " & e.DataRow("_Identify") ) '取得该天的最大编号
                    If max > "" Then '如果存在最大编号
                        idx = CInt(max.Substring(14,3)) + 1 '获得最大编号的后三位顺序号,并加1
                    Else
                        idx = 1 '否则顺序号等于1
                    End If
                    e.DataRow("零售单编号") = bh & Format(idx,"000")
                End If
            End If
        End If
    End If
End If

 

我在零售录入窗口修改日期之后,有时候会弹出“未将对象应用设置到对象的实例”的错误,并且设置了默认日期,并增加行之后,零售单编号会出现重复。但是有的时候又一切正常,没有丝毫问题,求解是因为什么原因?


 回到顶部
总数 75 1 2 3 4 5 6 7 8 下一页