Rss & SiteMap

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

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

标题:MYSQL源限制按键问题

1楼
lin98 发表于:2023/8/26 15:48:00
MYSQL源   限制按键问题,
需求:如果主表的主表单号为空,明细表的明细单号为空时,窗口上的新增按键,可以新增,新增按键为可编辑,窗口可关闭,否则,窗口上的新增按键,不可以新增,新增按键为不可编辑,窗口不可关闭。如何实现?

注:明细表的明细单号,如果10条记录,须10条都为空或10条不为空,只要有一条记录不满足,则所条件不满足
2楼
有点蓝 发表于:2023/8/26 16:11:00
到主表的currentchanged事件判断

If e.Table.Current Is Nothing Then '如果Current为Nothing
    Return '则返回
End
 If

if e.Table.Current.isnull("单号") andalso Tables("明细表").compute("count(单号)","单号is not null") = 0 then
e.form.controls("新增").enabled = true
else
e.form.controls("新增").enabled = false
endif

窗口关闭到BeforeClose时间处理:http://www.foxtable.com/webhelp/topics/0712.htm
3楼
lin98 发表于:2023/8/29 18:52:00
if e.Table.Current.isnull("主表单号") andalso Tables("明细表").compute("count(明细单号)","明细单号is not null") = 0 then
e.form.controls("新增").enabled = true
else
e.form.controls("新增").enabled = false
endif
上面代码报错,如何解决?

NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:登记主表,CurrentChanged
详细错误信息:
未将对象引用设置到对象的实例。





4楼
有点蓝 发表于:2023/8/29 20:05:00
参考:http://www.foxtable.com/webhelp/topics/0641.htm,看看注意事项
5楼
lin98 发表于:2023/8/29 20:12:00

If e.Table.Current Is Nothing Then '如果Current为Nothing
    Return '则返回
End
 If

if e.Table.Current.isnull("主表单号") andalso Tables("明细表").compute("count(明细单号)","明细单号is not null") = 0 then
e.form.controls("新增").enabled = true
else
e.form.controls("新增").enabled = false
endif
执行上面代码,调试是红代码报错,如何解决?

NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:登记主表,CurrentChanged
详细错误信息:
未将对象引用设置到对象的实例。
6楼
有点蓝 发表于:2023/8/29 20:13:00
If e.Table.Current Is Nothing andalso forms("某窗口").opened Then '如果Current为Nothing
    Return '则返回
End
 If

if e.Table.Current.isnull("主表单号") andalso Tables("明细表").compute("count(明细单号)","明细单号 is not null") = 0 then
forms("某窗口").controls("新增").enabled = true
else
forms("某窗口").controls("新增").enabled = false
endif
7楼
lin98 发表于:2023/8/30 0:50:00
需求:如果明细表的明细单号为空时,窗口上的新增按键为不可编辑,否则,窗口上的新增按键,可以新增
注:明细表的明细单号,如果10条记录,须10条都为空或10条不为空,只要有一条记录不满足,则所条件不满足

执行下面代码,没报错,但失效,达不到需求,如何解决?
'If DataTables("登记明细").compute("count(订单单号)", "订单单号 is not null") > 0 Then
'    forms("登记窗口").controls("新增").enabled = True
'    forms("登记窗口").controls("保存").enabled = True
    
'Else
'    forms("登记窗口").controls("新增").enabled = False
'    forms("登记窗口").controls("保存").enabled = False
    
'End If
8楼
有点蓝 发表于:2023/8/30 8:53:00
【10条都为空或10条不为空】新增按键为不可编辑?

其它情况(部分为空部分有数据)可以新增?
9楼
lin98 发表于:2023/8/30 14:42:00
老师,模拟关联,当前窗口的当前明细表,比如有10条记录须10条不为空,才能新增按键为可编辑 ,否则,新增按键为不可编辑,部分为空或有一条为空,新增按键为不可编辑


10楼
有点蓝 发表于:2023/8/30 14:44:00
If DataTables("登记明细").compute("count(订单单号)", "订单单号 is null") = 0 Then
   forms("登记窗口").controls("新增").enabled = True
else
……
共23 条记录, 每页显示 10 条, 页签: [1] [2][3]

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

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