以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  未将对象引用设置到对象的实例  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=131468)

--  作者:蓝蚂蚁
--  发布时间:2019/2/27 9:33:00
--  未将对象引用设置到对象的实例
.NET Framework 版本:2.0.50727.5466
Foxtable 版本:2018.10.9.1
错误所在事件:窗口,检查录入检验报告用小窗口,KeyDown
详细错误信息:
未将对象引用设置到对象的实例。
其KeyDown代码如下:
If e.keycode = 13 Then
    e.form.controls("button1").Select
    e.form.controls("button1").performclick
    e.form.controls("TextBox3").Select
End If
出现这错误,是偶尔的,请问老师是不是代码有问题?

--  作者:有点甜
--  发布时间:2019/2/27 9:42:00
--  

 

你button1的click事件的代码有问题,贴出对应代码看看。

 

 


--  作者:蓝蚂蚁
--  发布时间:2019/2/27 9:45:00
--  
Dim Filter As String
With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "通用名称 like \'%" & .Value & "%\'"
    End If
End With

With e.Form.Controls("TextBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "生产企业 like \'%" & .Value & "%\'"
    End If
End With

With e.Form.Controls("TextBox3")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "批号 like \'%" & .Value & "%\'"
    End If
End With
Tables("计划来货登记表查询主窗口_Table1").Filter = Filter

--  作者:有点甜
--  发布时间:2019/2/27 9:53:00
--  

 

你表格的currentChanged事件有问题,贴出对应代码。

 


--  作者:蓝蚂蚁
--  发布时间:2019/2/27 9:56:00
--  
If e.DataCol.Name = "产品计划编码" Then
    If e.newvalue = Nothing Then
        e.DataRow("配送公司")= Nothing
    Else
        e.DataRow("配送公司") =Tables("采购计划总表").current("配送公司")
        e.DataRow("计划年月") =Tables("采购计划总表").current("年月份")
    End If
End If
If e.DataCol.Name = "注册证号" Then \'发生变化的是中标号吗?
    If  e.DataRow("注册证号")=Nothing Then
        e.DataRow("耗材类别")=Nothing
    Else
        Dim Str1 As String = e.DataRow("注册证号")
        Dim str2 As String
        If Str1.Contains("备")=True Then
            e.DataRow("耗材类别")="I类"
        End If
        If Str1.Contains("消")=True Then
            e.DataRow("耗材类别")="消字类"
        End If
        If Str1.Contains("注准")=True Or Str1.Contains("注进")=True Or Str1.Contains("注许")=True   Then
            str2=str1.SubString(8,1)
            If str2=3 Then
                e.DataRow("耗材类别")="III类"
            End If
            If str2=2 Then
                e.DataRow("耗材类别")="II类"
            End If
            If str2=1 Then
                e.DataRow("耗材类别")="I类"
            End If
        End If
        If Str1.Contains("字")=True And Str1.Contains("第")=True
            Dim chr1 As Char = "第"
            Dim str4() As String
            Dim str5 As String
            str4=e.DataRow("注册证号").split(chr1)
            str5=str4(1).SubString(0,1)
            If str5=1 Then
                e.DataRow("耗材类别")="I类"
            End If
            If str5=2 Then
                e.DataRow("耗材类别")="II类"
            End If
            If str5=3 Then
                e.DataRow("耗材类别")="III类"
            End If
        End If
    End If
End If
If e.DataCol.Name = "批号" Then
    Dim str1 As String = e.DataRow("批号")
    Dim str2 As String
    str2 = str1.ToUpper()
    e.DataRow("批号")=str2
    \'----
    
    \'---
    
    
End If
\'If e.DataCol.name = "检验报告" OrElse e.DataCol.name = "批号" Then
If  e.DataCol.name = "检验报告" Then
    e.DataTable.ReplaceFor("检验报告", e.DataRow("检验报告"), "批号 = \'" & e.DataRow("批号") & "\' and 目录编号 = \'" & e.DataRow("目录编号") & "\'")
End If
If e.DataCol.Name = "批号" Then
    Dim dr As DataRow
    dr = DataTables("计划来货登记表").Find("批号= \'" & e.DataRow("批号") & "\' and 目录编号 = \'" & e.DataRow("目录编号") & "\'")
    If dr IsNot Nothing \'如果找到, 则设置各列内容
        If dr("检验报告")=True Then
            e.DataRow("检验报告")= True
        Else
            e.DataRow("检验报告")= False
        End If
    End If
    If e.DataRow("批号")=Nothing
        e.DataRow("检验报告")=False
    End If
End If
If e.DataCol.Name = "显非" AndAlso e.DataRow("显非") = False Then
    For Each t As Table In Tables
        If t.DataTable.name = "计划来货登记表" Then
            t.Cols("非计划").Visible = False            
            t.Cols("非计划生产企业").Visible = False
            t.Cols("非计划采购价").Visible = False
        End If
    Next
ElseIf e.DataCol.Name = "显非" AndAlso e.DataRow("显非") =True Then
    For Each t As Table In Tables
        If t.DataTable.name = "计划来货登记表" Then
            t.Cols("非计划").Visible = True            
            t.Cols("非计划生产企业").Visible = True
            t.Cols("非计划采购价").Visible = True
        End If
    Next
End If
If e.DataCol.Name = "非计划" AndAlso e.DataRow("非计划") = True Then
    e.DataRow("生产企业")=e.DataRow("非计划生产企业")
    e.DataRow("中标价")=e.DataRow("非计划采购价")
    e.DataRow("采购价")=e.DataRow("非计划采购价")
End If
If e.DataCol.Name = "目录编号" Then \'发生变化的是中标号吗?
    Dim dr As DataRow
    dr = DataTables("医用耗材目录").Find("[目录编号]=\'" & e.DataRow("目录编号") & "\'" )
    If dr IsNot Nothing \'如果找到, 则设置各列内容
        e.DataRow("中标号或编号")= dr("中标号或编号")
    Else
        e.DataRow("中标价")=Nothing
    End If
    Dim drzczh As DataRow
    With DataTables("计划来货登记表")
        drzczh = .Find("目录编号 = \'" & e.DataRow("目录编号") & "\'" ,"来货日期 Desc") \'找出最后一次订购PD01产品的记录
        If drzczh IsNot Nothing Then
            e.DataRow("注册证号") =drzczh("注册证号")
        Else
            e.DataRow("注册证号") =Nothing
        End If
    End With    
End If
If e.DataCol.Name = "审核" Then 
        If e.DataRow("审核")=True Then
            e.DataRow.Locked = True
        Else
            e.DataRow.Locked = False
        End If
End If

--  作者:有点甜
--  发布时间:2019/2/27 10:03:00
--  
表格的currentChanged事件有问题,贴出对应代码。
--  作者:蓝蚂蚁
--  发布时间:2019/2/27 10:15:00
--  
【表格的currentChanged事件有问题,贴出对应代码。】里面没有代码的
--  作者:有点甜
--  发布时间:2019/2/27 10:16:00
--  
Table1的currentChanged事件;如果是副本表,贴出主表的currentChanged事件。
--  作者:有点甜
--  发布时间:2019/2/27 10:16:00
--  

 

不然,请做一个实例发上来测试。

 


--  作者:蓝蚂蚁
--  发布时间:2019/2/27 10:18:00
--  
谢谢 老师耐心的解答  暂时不理吧  这个实例很大  反正是偶尔出现的