Results 1 to 4 of 4
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,329

    Adding a paragrpgh using InStr

    Hi Guy's, I am bit rusty with VBA at the moment as had a lot of things happening away from this,



    How do I add a paragraph if a tick box is checked after a specific paragraph ?

    So something like

    Code:
    Dim OrgMessage As String, MyStart As String, MyEnd As String, AddData As String
    OrgMessage = Me.txtMailMessage
    If Me.tbxSendPDF = True Then
    AddData = "The serial number provided does not appear to match the critera of your enquiry details, before we fully commit to any" & _
    "agreement, please identify your enquiry from our PDF document attached ?, your product is listed with an image and image number" & _
    "please provide us with this image number to enable us to help"
    OrgMessage = Me.txtMailMessage
    'I want to find the word void in the orgmessage and call it MyStart
    'I want to try and add 2 new lines (new paragraph)
    'Then add AddData in this space after the paragraph ending in void
    'Then the rest of teh original message called MyEnd
    'So the end result is tbxSendPDF is checked is:
    '1 mystart (everything before the word void from OrgMessage)
    '2 AddData
    '3 MyEnd
    Me.txtMailMessage = MyStart & AddData & MyEnd
    Else
    DoCmd.CancelEvent
    End If
    

  2. #2
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,329
    Hi Guy's just noticed my dislexic fingers Paragraph was meant to be the subject

  3. #3
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,329
    The MyStart upto the word void needs to include the word void so thats the last word in MyStart, then add 2 lines and add AddData then add 2 more lines and add MyEnd, unsure if i made the earlier post clear enough!

    Kindest

  4. #4
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,329
    Hey guy's i have acheived this, wiped the rust off and thought about it got it working from an older posted StringPart

Please reply to this thread with any new information or opinions.

Similar Threads

  1. InStr not as expected
    By GraeagleBill in forum Programming
    Replies: 3
    Last Post: 08-10-2018, 05:53 PM
  2. INSTR Help
    By scubaman63 in forum Queries
    Replies: 1
    Last Post: 08-02-2018, 07:43 AM
  3. InStr Help
    By MTSPEER in forum Programming
    Replies: 18
    Last Post: 09-07-2017, 07:34 AM
  4. Replies: 2
    Last Post: 04-07-2016, 07:19 AM
  5. IIF with instr
    By yoili in forum Reports
    Replies: 2
    Last Post: 01-22-2013, 01:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums