First of all the two separate Controls (Not Fields.) that you are referring to should have Event Procedures for AfterUpdate and we assume (Let us know if not safe to.) that all saved records have either both or neither Field set (A Field refers to the items of data - typically within a table - whereas the items on a Form that give access to that data are Controls).
For simplicity, and tidiness of code, we create a separate subroutine procedure that determines if the SaveRecordButton CommandButton Control should be enabled or otherwise. This is then invoked wherever necessary.
So, to start with let's see what the sub procedure would look like :
- Private Sub EnableSave()
-
With Me
-
.SaveRecordButton.Enabled = (IsNull(.txtNI) = IsNull(.txtFS))
-
End With
-
End Sub
An example of what one of your Event Procedures should look like would be :
- Private Sub txtNI_AfterUpdate()
-
Call EnableSave
-
End Sub
That should give you all you need. Let us know if it all makes sense or if you get stuck implementing it.
Before we finish I need to draw your attention to a problem you really don't need. "cbo" at the start of a name indicates to anyone reading the code that the item is a ComboBox Control. In your case you describe both of your Controls as TextBoxes. That is really not good. A little like learning to fire a gun and starting with your own foot. In my example code I've called these two Controls by the names you
should be using.