Consulting

Results 1 to 5 of 5

Thread: Access ignoring the 
 from xml file

  1. #1
    VBAX Newbie
    Joined
    Feb 2021
    Posts
    3
    Location

    Question Access ignoring the 
 from xml file

    Hello,

    when I insert a xml string "reprovados
    Fazer" into a long text field of a access table I see it like this "reprovadosFazer"

    Even in the access form based on that table I see it like this "reprovadosFazer"
    But if I copy it into a notepad++ I see it as it should with the CRLF

    reprovados
    Fazer

    What should I do to have always the correct format ? in the form and in the table

    Thanks in advance
    Ana

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,263
    Location
    How are you "inserting" the string?
    How are obtaining the string from the xml file?

  3. #3
    VBAX Newbie
    Joined
    Feb 2021
    Posts
    3
    Location
    Quote Originally Posted by OBP View Post
    How are you "inserting" the string?
    How are obtaining the string from the xml file?
    ...
    Set objDoc = CreateObject("Msxml2.DOMDocument.3.0")
    objDoc.async = False

    objDoc.validateOnParse = True
    objDoc.Load pURL
    If (objDoc.parseError.errorCode <> 0) Then
    Set objParseErr = objDoc.parseError
    MsgBox ("Ficheiro Nao Encontrado " & objParseErr.reason)
    Set objDoc = Nothing
    End If

    ...
    xmlvalOutosgrafica = objDoc.SelectSingleNode("//Detail").Attributes.getNamedItem("ft_pg_link_texto").Text
    strValueList = strValueList & ", '" & _
    Replace(xmlvalOutosgrafica, "'", "''") & "'"

    ...
    strSql_Enc = "INSERT INTO encomendas (n_encomenda_luso,data_encomenda,n_cliente,tipo_estado,qtd_cilindros_ferro, " & _
    strFieldList_Enc & ",repeticao,departamento,tipo_impressao,outros_grafica)" & vbNewLine & _
    "VALUES ('" & intNEncomendaLuso & "',Date(),'" & strIdCli & "',13,0" & strValueList & ");"

    CurrentDb.Execute strSql_Enc, dbFailOnError



    Here are the parts of the code.
    Thanks

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,263
    Location
    Which string or fieldname is giving you the problem?
    If you can identify it we should be able to replace the offending characters, unless it is the vbNewLine in the insert statement that is not working.

  5. #5
    VBAX Newbie
    Joined
    Feb 2021
    Posts
    3
    Location
    Sorry for the late reply

    this is where a get the field from the xml

    xmlvalOutosgrafica = objDoc.SelectSingleNode("//Detail").Attributes.getNamedItem("ft_pg_link_texto").Text

    then I append it to the
    strValueList

    I mean the the CR and the LineFeed are there in the field's table because when I copied from access to notepad or word it respects the CRLF.
    Only in the Access Form is not showing.




Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •