locked
sql linebreak vba RRS feed

  • Question

  • can i add a linebreak in a field in vba 

    i need an sql update statement that puts a linebreak in a field and then the text i want

    strsql = "update myfile  set orderdesc = [orderdesc]" & vbcrlf & "tekst""  
               DoCmd.RunSQL strsql
              

    Saturday, June 16, 2018 10:52 AM

Answers

  • Hello tekoko10,

    Sorry for late reply!

    Please try sql string like

    strsql = "update myfile  set orderdesc = [orderdesc]+'" & vbCrLf & "tekst'"
    DoCmd.RunSQL strsql

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by tekoko10 Friday, June 22, 2018 11:03 AM
    Friday, June 22, 2018 10:02 AM

All replies

  • Hello tekoko10,

    Sorry for late reply!

    Please try sql string like

    strsql = "update myfile  set orderdesc = [orderdesc]+'" & vbCrLf & "tekst'"
    DoCmd.RunSQL strsql

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by tekoko10 Friday, June 22, 2018 11:03 AM
    Friday, June 22, 2018 10:02 AM
  • You might also want to try vbNewline instead of vbCrLf. It's supposed to work with all versions of Windows and Office while the latter might not.

    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    Friday, June 22, 2018 8:49 PM