以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 表对应的按钮可用不可用? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=152753) |
-- 作者:2425004926 -- 发布时间:2020/7/21 9:31:00 -- 表对应的按钮可用不可用? 表A副本为当前表时,按钮1可用 表B副本为当前表时,按钮2可用 表C副本为当前表时,按钮3可用 下面的代码为什么都不行,应该如何写? 一、 If e.Sender.Name = "table1" Then e.Form.Controls("Button1").Enabled = Truee.Form.Controls("Button2").Enabled = False e.Form.Controls("Button3").Enabled = False ElseIf e.Sender.Name = "table2" Then e.Form.Controls("Button1").Enabled = False e.Form.Controls("Button2").Enabled = True e.Form.Controls("Button3").Enabled = False ElseIf e.Sender.Name = "table3" Then e.Form.Controls("Button1").Enabled = False e.Form.Controls("Button2").Enabled = False e.Form.Controls("Button3").Enabled = True End If 二、 If CurrentTable.Name = "table1" Thene.Form.Controls("Button1").Enabled = True e.Form.Controls("Button2").Enabled = False e.Form.Controls("Button3").Enabled = False ElseIf CurrentTable.Name = "table2" Then e.Form.Controls("Button1").Enabled = False e.Form.Controls("Button2").Enabled = True e.Form.Controls("Button3").Enabled = False ElseIf CurrentTable.Name = "table3" Then e.Form.Controls("Button1").Enabled = False e.Form.Controls("Button2").Enabled = False e.Form.Controls("Button3").Enabled = True End If 三、 If e.Sender.Name = "公司_table1" Thene.Form.Controls("Button1").Enabled = True e.Form.Controls("Button2").Enabled = False e.Form.Controls("Button3").Enabled = False ElseIf e.Sender.Name = "公司_table2" Then e.Form.Controls("Button1").Enabled = False e.Form.Controls("Button2").Enabled = True e.Form.Controls("Button3").Enabled = False ElseIf e.Sender.Name = "公司_table3" Then e.Form.Controls("Button1").Enabled = False e.Form.Controls("Button2").Enabled = False e.Form.Controls("Button3").Enabled = True End If |
-- 作者:y2287958 -- 发布时间:2020/7/21 9:44:00 -- 你这代码用在哪里 |
-- 作者:有点蓝 -- 发布时间:2020/7/21 9:48:00 -- 表格有自己独立的事件,不受窗口事件影响,到各个表格的cilck事件处理,比如 If Forms("公司").Opened Forms("公司").Controls("Button1").Enabled = False Forms("公司").Controls("Button2").Enabled = True Forms("公司").Controls("Button3").Enabled = False End If |
-- 作者:2425004926 -- 发布时间:2020/7/21 10:06:00 -- 非常谢谢!代码放到表格的cilck事件,OK |