in Access 2010 (x64) I have a method declared in a class module as below:
Public Sub addFieldAndValueToXML(fieldName As String, value As String)
xmlStr = xmlStr & "<field name=""" & fieldName & """><value>" & value & "</value></field>"
End Sub
I call it from a method on a form as below:
For i = 0 To 4
If Not .EOF Then
Dim n As Integer
n = i + 1
'Stop
builder.addFieldAndValueToXML "FINDINGS Include applicable referencesRow" & n, Nz(!FIndings, "")
Select Case !RatingID
Case 1
builder.addFieldAndValueToXML "MAJORRow" & n, "X"
builder.addFieldAndValueToXML "MINORRow" & n, ""
Case 2
builder.addFieldAndValueToXML "MAJORRow" & n, ""
builder.addFieldAndValueToXML "MINORRow" & n, "X"
Case Else
builder.addFieldAndValueToXML "MAJORRow" & n, ""
builder.addFieldAndValueToXML "MINORRow" & n, ""
End Select
builder.addFieldAndValueToXML "FOCUS AREARow" & _
n, Left(DLookup("Discrepancy_Type", "DiscrepancyType_Tbl", "DiscrepancyTypeID =" & !DiscrepancyTypeID), 1)
.MoveNext
End If
Next i
The purpose of the code is to build an xml string that is output to a .xfdf file, and it appears to be working fine except for the lines where fieldName
is given the value "MAJORRow"
.
When I step through the code I can see that the lines prior to, and after the offending lines call the method properly, and I can see the fieldName
and value
arguments being populated properly.
However on the offending lines, fieldName
is not being populated at all, whereas value
is.
I've tried a number of different values for fieldName
("majorrow", "maj_row", "MAJ_Row", etc.) and when the combination "AJ" (has to be capitalized) is in the string, it fails to populate fieldName
.
I've checked for reserved words, and done a fair bit of searching but can find nothing relating to this at all. Has anyone else come across this?
I'm running Windows 10 (x64).
Cheers.