以文本方式查看主题

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

--  作者:swagger
--  发布时间:2018/4/14 23:35:00
--  不load数据,未将对象引用设置到对象的实例。
If Tables("订单").Current.IsNull("客户名称") = True then
MessageBox.Show("没有选择客户!") 
else 

Tables("订单").addnew()
end if 


提示:未将对象引用设置到对象的实例。该怎么写?



--  作者:swagger
--  发布时间:2018/4/14 23:39:00
--  
If Tables("订单").Current Is Nothing Then 


Tables("订单").addnew()

ElseIf Tables("订单").Current.IsNull("客户名称") = True Then
MessageBox.Show("没有选择客户!") 

Else If Tables("订单").Current IsNot Nothing Then 

If Tables("订单").Current.IsNull("客户名称") = True Then
MessageBox.Show("没有选择客户!") 
Else 

Tables("订单").addnew()

End If 

End If


这样写,貌似可以,不知道行不行,有没有其它写法

--  作者:有点甜
--  发布时间:2018/4/15 11:17:00
--  
If Tables("订单").Current Is Nothing Then
    MessageBox.Show("没有数据")
ElseIf Tables("订单").Current.IsNull("客户名称") = True Then
    MessageBox.Show("没有选择客户!")
Else
    Tables("订单").addnew()
End If