如何在访问表单上将基于选择的组合框更改为数字字段为0

时间:2013-05-24 11:14:13

标签: .htaccess ms-access ms-access-2007 access-vba

嘿,有任何帮助将不胜感激谢谢 我有一个组合框字段=名称(txtCombo) 并且numberField =(txtNumber)

我的代码出错了,任何帮助都会受到高度赞赏。谢谢

Private Sub txtCombo_Click()
If Me.txtCombo.Value = "Meter" Then
Me.txtNumber.Value = 0
End If
End Sub

错误我的代码:

运行时错误:'2448'您无法为对象分配值,由于此代码我无法继续计算!!!

如果我选择Meter值,则必须将txtNumber更改为0

1 个答案:

答案 0 :(得分:0)

Private Sub txtCombo_AfterUpdate()

If (Me.txtCombo.Value = "Meter") Then

Me.txtNumber.Value = "0"

End If

End Sub

如果我理解正确,如果在组合框中选择了仪表,则希望将文本框值设置为0,那么这将起作用,使用此代码并将其放入combox中的更新后事件中。