Change event not firing

J

Jarryd

Hi,

I want to force users to create a record using the main form before they add
records to the subform/linked table. If they try to add data to the
subform/linked table a message box should display, undo the change to the
control's data, and set focus to the txtNew_Bill contnrol. So I read up
about the Undo method and the help file told me to use it on the Change
event of a control. The control is a Textbox and the form is in Datasheet
view. The first time it actually workd fine; the first character that was
entered in the control when the Form_frmMobile_Bills.txtBillHdn was hidden
the message displayed, the data was reset and the the focus moved.

But since then it hasn't worked. The only way to get it to work is to use
the AfterUpdate event, but then the Undo method doesn't work and the data
remains in the Textbox:

Private Sub txtCost_Change()
If IsNull(Form_frmMobile_Bills.txtBillHdn) Then
MsgBox "Please create bill before entering call data."
Me.txtCost.Undo
Form_frmMobile_Bills.txtNew_Bill.SetFocus
End If
End Sub

Does anyone have any ideas?

TIA,

Jarryd
 

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