Textbox.value update

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.t­xtSerialNum.Value) = True Or
IsNull(Form_frmWDBarcodeInfo.t­xtSKU.Value) = True Or
IsNull(Form_frmWDBarcodeInfo.t­xtPartNum.Value) = True Then
Form_frmWDBarcodeInfo.cmdAddNe­w.Enabled = False
Else
Form_frmWDBarcodeInfo.cmdAddNe­w.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
 
G

Guest

I think you might need to try your code in the On Change event for your
textboxes. I'm no expert and therefor can't give you the entire solution, but
the On Change event fires with every keystroke therefor as soon as you type
one character your code should do what you need.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top