在编号的更新后事件中写:
me.提取默认值.Enabled =isnull(me.赎单编号.value)
如果要同时控制今日付款按钮的可用性,则可以按一下方法处理:
1、写一个自定义函数
function SetBtnEnabled(ctrlname as string)
dim ctrl as control
dim B as boolean
b=true
for each ctrl in me.controls
if ctrl.controltype=acComboBox or ctrl.controltype=acTextBox then
if left(ctrl.controls(0).caption,1)="*" then '找到必填控件
b=b and isnull(ctrl.value)=false
if ctrl.name="赎单编号" then
me.提取默认值.Enabled=isnull(ctrl.value) '控制提取默认值按钮的可用性
end if
end if
end if
next
me.今日付款.Enabled=b '控制今日付款按钮的可用性
end function
2、在窗体的加载程序中写:
dim ctrl as control
for each ctrl in me.controls
if ctrl.controltype=acComboBox or ctrl.controltype=acTextBox then
if left(ctrl.controls(0).caption,1)="*" then
ctrl.AfterUpdate ="=SetBtnEnabled('" & ctrl.name & "')"
end if
end if
next