Results 1 to 4 of 4
  1. #1
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133

    Question String within a String Expression?

    How do I get str2 to recognize str1 within it's expression, and not just as text?



    Code:
    Private Sub cmdButton1_Click()
    
    Dim str1 As String
    Dim str2 As String
    
    str1 = "Hello"
    str2 = " John said str1 to me yesterday"
    
    'How do I get it to recognize str1 in the above statement as a String and not text?
    
    Me.txtBox1.Text = str2
    
    
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    How about:

    str2 = " John said " & str1 & " to me yesterday"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Forbes's Avatar
    Forbes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2017
    Posts
    133
    This worked perfectly, thank you!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 6
    Last Post: 06-20-2016, 01:29 PM
  2. Add string to expression in Control Source
    By jmitchelldueck in forum Reports
    Replies: 5
    Last Post: 07-20-2015, 06:10 PM
  3. VBA string with OR expression
    By hmcquade in forum Forms
    Replies: 3
    Last Post: 06-24-2011, 07:59 AM
  4. Replies: 1
    Last Post: 02-03-2011, 07:41 AM
  5. Replies: 0
    Last Post: 12-05-2005, 04:09 AM

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
  •  
Other Forums: Microsoft Office Forums