Change Event

S

Stephen @ ZennHAUS

Hi guys and gals

I have a form with 4 controls. A text box (txtDate), 2 combo boxes (cbxShift
and cbxTruck) and a command button (cmdAdd).

The data controls are all unbound.

The purpose of the form is as an intermediary to adding records. The user
enters Date, Shift and Truck and then the form checks to see if the records
exist. If so the Add Details form is opened at the appropriate record. If
not, the records are added to a primary table and then the Add Details form
is opened with the new record, thus ensuring duplicate data is not entered
without the use of a multi field primary key.

Anyhoo. The Enabled property for cmdAdd is set to FALSE so that it cannot
be clicked until the form has been filled out.

I have code that checks the content of the 3 data controls to see if they
have data in them. Once they all have data in them, the Enabled property for
cmdAdd is set to TRUE.

The code that checks content is called via the Change even on each of the 3
controls.

However, if the user types in the combo box to select an item from the list
(eg the user types "D" to select "Day shift"), the Change event for the
combo box is not triggered and so the checking code does not work. If the
user clicks on an item in the list, all works well.

I have tried the Dirty event, but the control technically has no value yet
when that event is triggered.

I have tried the BeforeUpdate event, but that does not work until the record
is about to be updated and since the control is unbound, it has no effect.

I have tried LostFocus, but if the user never leaves the control before
trying to click on cmdAdd, then that doesn't work.

I have tried KeyPress which just doesn't work at all.

So please, if someone knows how I can resolve this, I would love to know.

Thanks

Stephen @ ZennHAUS
 
A

Arvin Meyer [MVP]

If a user types a character in a combobox, the change event fires. It fires
again with each subsequent character. Perhaps you should be using the After
update event.
 

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