G
gt54
Hi,
New at vb here and am making a database in access. I am having a
problem trying to update the state of a button on a form. The button
should be enabled only if all three textboxes have text in them and the
button should be disabled if at least one of the textboxes becomes
empty.
The problem is is that the "textbox.value" is only updated when I tab
between the textboxes, I want "textbox.value" to update on any and all
changes in the textboxes on the form. I hope that is clear. Here is the
function I wrote that is tied to each textbox's On Key Press event. I
tried the On Change event as well and had the same result.
Function updateAddNewButton()
If IsNull(Form_frmWDBarcodeInfo.txtSerialNum.Value) = True Or
IsNull(Form_frmWDBarcodeInfo.txtSKU.Value) = True Or
IsNull(Form_frmWDBarcodeInfo.txtPartNum.Value) = True Then
Form_frmWDBarcodeInfo.cmdAddNew.Enabled = False
Else
Form_frmWDBarcodeInfo.cmdAddNew.Enabled = True
End If
End Function
So the upshot is that the code works but vb is not updating the value
property on every keypress, which is what I want.
I know my code is probably horrid, any help is appreciated. If more
info is needed please let me know.
Thanks,
Stan
New at vb here and am making a database in access. I am having a
problem trying to update the state of a button on a form. The button
should be enabled only if all three textboxes have text in them and the
button should be disabled if at least one of the textboxes becomes
empty.
The problem is is that the "textbox.value" is only updated when I tab
between the textboxes, I want "textbox.value" to update on any and all
changes in the textboxes on the form. I hope that is clear. Here is the
function I wrote that is tied to each textbox's On Key Press event. I
tried the On Change event as well and had the same result.
Function updateAddNewButton()
If IsNull(Form_frmWDBarcodeInfo.txtSerialNum.Value) = True Or
IsNull(Form_frmWDBarcodeInfo.txtSKU.Value) = True Or
IsNull(Form_frmWDBarcodeInfo.txtPartNum.Value) = True Then
Form_frmWDBarcodeInfo.cmdAddNew.Enabled = False
Else
Form_frmWDBarcodeInfo.cmdAddNew.Enabled = True
End If
End Function
So the upshot is that the code works but vb is not updating the value
property on every keypress, which is what I want.
I know my code is probably horrid, any help is appreciated. If more
info is needed please let me know.
Thanks,
Stan