Hi,
Previously, I was having errors when a user would clear or exit out of a form without clicking the “Submit” button, and the record was still be inserted into the Table. In an attempt to combat this, I have included the following code:
So, my problem now is that I need an If statement to check whether a control (cboModNum) on my subform (sfrmAddMod) is getting focus. This is because, when I click on my subform, it causes the Form_BeforeUpdate Event to occur, which then tests my Boolean value used to decide whether a record should be updated, and when its seen that it is false, it deletes all the data from my other input comboboxes. But, I can’t quite figure out the correct If statement to Nest within the statement testing the blnGood value in order to keep my other combobox values from getting deleted when clicking into the subform.Code:Private Sub Form_BeforeUpdate(Cancel As Integer) If blnGood = False Then If (Me!SfrmAddMod2.Form.cboModNum Is Me.ActiveControl) Then‘ This is what I am still searching fo …. (text but this doesn’t really matter.. so long as the else doesn’t run) Else Cancel = True Me.Undo Cancel = False End If End If
Any help is greatly appreciated, as I have probably spent way too much time on this already. I’d also be happy to further clarify anything if it helps!
Thank you!