BeforeUpdate and KeyDown

  • Thread starter Thread starter croy
  • Start date Start date
C

croy

For a combobox control, I have put some code behind the
BeforeUpdate event, and it works very well... unless the
user enters the value by using a key that I've set the
KeyDown event for--then the BeforeUpdate code doesn't seem
to fire.

I tried to add a call to the BeforeUpdate code in the OnExit
event, but I can't seem to make that work, either.

If I put this line in:

Call cboMarkTypeId_BeforeUpdate

I get a message stating that the argument is not optional.

If I put this line in:

Call cboMarkTypeId_BeforeUpdate(Cancel As Integer)

I get a different error message.

I also noticed that if there is a Default Value set for the
field, and it is tabbed thru, accepting the Default Value,
the BeforeUpdate code doesn't fire.

How can I get the BeforeUpdate code to fire when a KeyDown
event enters a value, or when the Default Value is not
molested?
 
How can I get the BeforeUpdate code to fire when a KeyDown
event enters a value, or when the Default Value is not
molested?

BeforeUpdate fires only when the user actually manually updates the field.
Either put the same code in your KeyDown event, or call the BeforeUpdate event
from your KeyDown code:

Call Form.BeforeUpdate(Cancel as Integer)
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
John W. Vinson said:
BeforeUpdate fires only when the user actually manually updates the field.
Either put the same code in your KeyDown event, or call the BeforeUpdate
event
from your KeyDown code:

Call Form.BeforeUpdate(Cancel as Integer)

Ahem.

Call Form.BeforeUpdate(False)
 
Back
Top