Question : Subform: me.dirty not working

I've got a form and a subform in Access 2000 (with SQL Server 2000 back-end, so this is an ADP, in case that's important).

In the subform, users can enter a value in a column called EbayNum. Some event code runs so that as SOON as the EbayNum value is entered into the subform control, the rest of the subform row will populate with other data, whether or not the user has clicked off of that subform row.

Generally this works fine, except that I need to have the subform get committed before the user has clicked off of the row. I am using Me.Dirty = False, but I keep getting the following error: "Runtime error '2115': The macro or function set to the BeforeUpdate or Validation Rule property for this field is preventing Microsoft Access from saving the data in the field."

Any clue why I'm getting this error? If I comment out the Me.Dirty statement, I can MANUALLY click the little pencil on the left of the subform row to make it not dirty.... Why can't I make that happen in the event code?

Answer : Subform: me.dirty not working

Instead of just changing the state of dirty, save the actual record.
   
    If Forms!frmCustomerMain.Dirty Then
        ' Forms!frmCustomerMain.SetFocus ' Use this if the subform doesn't have the focus before saving
        DoCmd.RunCommand acCmdSaveRecord
    End If

Changing the state of dirty is simply leaving access unsure about what to do with the changes. Forcing a save instead of just changing the dirty state should work.
Random Solutions  
 
programming4us programming4us