Foxtable(狐表)用户栏目专家坐堂 → beforeclose错误


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

主题:beforeclose错误

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


加好友 发短信
等级:八尾狐 帖子:1837 积分:12984 威望:0 精华:0 注册:2013/6/10 9:23:00
beforeclose错误  发帖心情 Post By:2017/1/20 23:00:00 [只看该作者]

BeforeClose
详细错误信息:
未将对象引用设置到对象的实例。

 

If Tables("hsbcusd1").Current.isnull("年份") = True Then
    MessageBox.Show("年份不能为空,请输入年份!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
    e.Cancel = True
End If
If Tables("hsbcusd1").Current.isnull("年月") = True Then
    MessageBox.Show("年月不能为空,请输入年月!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
    e.Cancel = True
End If

 

请老师告知错在哪里? 这段代码如何正确写?


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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/1/20 23:13:00 [只看该作者]

If Tables("hsbcusd1").Current IsNot Nothing AndAlso Tables("hsbcusd1").Current.isnull("年份") = True Then
    MessageBox.Show("年份不能为空,请输入年份!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
    e.Cancel = True
End If

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


加好友 发短信
等级:八尾狐 帖子:1837 积分:12984 威望:0 精华:0 注册:2013/6/10 9:23:00
  发帖心情 Post By:2017/1/20 23:16:00 [只看该作者]

还有一个年月,把这段代码再写一遍对吗

 

如果年份未填写,就拒绝关闭窗口, 如果年份填写了,但是年月未填写,也拒绝关闭窗口!如何写

[此贴子已经被作者于2017/1/20 23:24:29编辑过]

 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106316 积分:540715 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/1/20 23:30:00 [只看该作者]

方法一样啊

If Tables("hsbcusd1").Current IsNot Nothing AndAlso Tables("hsbcusd1").Current.isnull("年月") = True Then

或者

If Tables("hsbcusd1").Current IsNot Nothing
    If  Tables("hsbcusd1").Current.isnull("年份") = True Then
        MessageBox.Show("年份不能为空,请输入年份!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
        e.Cancel = True
    ElseIf Tables("hsbcusd1").Current.isnull("年月") = True Then
        MessageBox.Show("年月不能为空,请输入年月!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
        e.Cancel = True
    End If
End If

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


加好友 发短信
等级:八尾狐 帖子:1837 积分:12984 威望:0 精华:0 注册:2013/6/10 9:23:00
  发帖心情 Post By:2017/1/20 23:34:00 [只看该作者]

If Tables("hsbcusd1").Current IsNot Nothing
    If  Tables("hsbcusd1").Current.isnull("年份") = True Then
        MessageBox.Show("年份不能为空,请输入年份!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
        e.Cancel = True
    ElseIf Tables("hsbcusd1").Current.isnull("年月") = True Then
        MessageBox.Show("年月不能为空,请输入年月!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
        e.Cancel = True
    End If
End If

 

 

好像有点问题, 我输入年份,未输入年月, 窗口也关闭了

年份和年月为空,不能关闭窗口,输入年份,年月为空不能关闭窗口,输入年月,年份为空不能关闭窗口,顺序先提示输入年份,年份输入后再提示输入年月

[此贴子已经被作者于2017/1/20 23:38:08编辑过]

 回到顶部
帅哥,在线噢!
有点蓝
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106316 积分:540715 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/1/21 8:43:00 [只看该作者]

不应该有问题的,试试
If Tables("hsbcusd1").Current IsNot Nothing
    If  Tables("hsbcusd1").Current.isnull("年份") = True Then
        MessageBox.Show("年份不能为空,请输入年份!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
        e.Cancel = True
    end if
    If Tables("hsbcusd1").Current.isnull("年月") = True Then
        MessageBox.Show("年月不能为空,请输入年月!","提示", MessageBoxButtons.OK ,MessageBoxIcon.Information)
        e.Cancel = True
    End If
End If

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


加好友 发短信
等级:八尾狐 帖子:1837 积分:12984 威望:0 精华:0 注册:2013/6/10 9:23:00
  发帖心情 Post By:2017/1/21 8:59:00 [只看该作者]

谢谢!


 回到顶部