Now I am going to add a triple state checkbox to the form.
I have added a new text field that can be nullable, and bound a new “TestCheckTripleState” checkbox to it.
The reason for this is that a “Yes/No” Access field cannot be null. It can only be true or false which causes problems trying to use the triple state which requires a true / false / null value set. Using a simple text field allows the values 0, -1, and null to be entered which is what the triple state checkbox wants to do.
I actually expect after having added the table field and form field, that a simple test might just pass. Let’s try it:
'@TestMethod("Verify Changes")
Private Sub WhenTripleStateCheckboxFieldChangesBeforeAndAfterValuesAreReturned()
Dim dctInputs As New Scripting.Dictionary, colResults As VBA.Collection
Set dctInputs = CreateAndAddToInputDict(FieldToChange:="TestCheckTripleState", InitialValue:=True, ChangeTo:=Null)
Set colResults = SetFields_ChangeThem_ReturnNewListOfChanges(dctInputs)
Assert.IsTrue FieldInputsMatchResults(dctInputs, colResults(1).FieldChanges)
End Sub
Now, this test is not passing. It seems there are issues when comparing the values in the “InputMatchResult” function on the NewMatches line. The function looks like this:
Private Function InputMatchesResult(FieldName As String, dctInputs As Scripting.Dictionary, dctResults As Scripting.Dictionary) As Boolean
Dim retVal As Boolean
Dim OldMatches As Boolean, NewMatches As Boolean
OldMatches = (dctResults(FieldName).OldValue = dctInputs(FieldName)(0))
NewMatches = (dctResults(FieldName).NewValue = dctInputs(FieldName)(1))
retVal = OldMatches And NewMatches
InputMatchesResult = retVal
End Function
So I will debug this in another session.