Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:空值不保存

1楼
明丰 发表于:2011/8/27 17:35:00

 


If e.DataRow.IsNull("基本单位") Then '基本单位为空时不能保存
Tables("货品资料").filter = "[基本单位] Is Null"
    messagebox.show("基本单位不能为空")
    e.Cancel = True '
End If

选择其它数据表前执行上面代码,请问如何设置?

2楼
明丰 发表于:2011/8/27 19:35:00

解决了.

'项目事件MainTableChanging
If e.NewTableName <> "货品资料" AndAlso e.OldTableName = "货品资料" Then
Dim dr As DataRow
    dr = DataTables("货品资料").Find("[基本单位] Is Null")
    If dr IsNot Nothing Then '
    e.Cancel = True
    Tables("货品资料").filter = "[基本单位] Is Null"
    messagebox.show("基本单位不能为空")
End If
End If

 

这样能避免多个表同时出现列空值不能保存需要每个表检查的情况.

[此贴子已经被作者于2011-8-27 20:57:02编辑过]
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01953 s, 2 queries.