以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  无对象实例报错,收银  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=128409)

--  作者:weibu
--  发布时间:2018/12/5 15:54:00
--  无对象实例报错,收银
老师当我输入的值不等于yh(“所属部门”)时提示“未将对象引用设置到对象的实例。”
我的代码时希望弹出提示框“溯源码不可用”;请老师看下代码有何错误
代码如下:
If e.KeyCode = Keys.ENTER Then
****省略代码
        If t.length <> 19 Then
        ***省略代码
        Else
        Dim fr As DataRow = DataTables("溯源码").SQLFind("当前所在部门 = \'" & yh("所属部门") & "\' And 子溯源码 like \'" & t & "%\' and len(子溯源码)=\'" & t.length+1 & "\'" )  \'溯源码表中的溯源码是否存在与盘点单据
            If fr IsNot Nothing And  fr("是否可用") = True  Then
              ***省略代码
                DataTables("外部出库").Save()
              e.Form.Controls("TextBox1").value = Nothing
              e.Form.Controls("textbox1").Select()
             Else
               MessageBox.Show("溯源码不可用!", "提示") 
            End If
          End If
End If

--  作者:有点甜
--  发布时间:2018/12/5 17:27:00
--  

If fr IsNot Nothing And  fr("是否可用") = True  Then

 

改成

 

If fr IsNot Nothing AndAlso fr("是否可用") = True  Then