0

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.

Erik A
  • 31,639
  • 12
  • 42
  • 67
Barry O'Kane
  • 1,189
  • 7
  • 12
  • There is no special issue with "AJ". It may be the use of combining more than one lower and uppercase in attribute names. Thus far, lower, caMel, PasCal, and UPPER cases are the [conventions](http://stackoverflow.com/questions/1074447/case-conventions-on-element-names). Possibly your app/processor cohering to `.xfdf` type maintains rules to the convention. – Parfait Oct 11 '15 at 22:28
  • 1
    Have you verified that the correct strings are being written out to the file and the problem occurs when you try to import the XML data into the target system? – Gord Thompson Oct 12 '15 at 02:14

0 Answers0