Results 1 to 4 of 4
  1. #1
    zashaikh is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    182

    Using VBA to Add a String of Text to a Field that already has a string of text

    Hello. I want to use VBA to add a string of text to a field that already has a string of text (as opposed to replacing it).



    For example, lets say I have a field called [Information] in frmMain. This field has a value of "Alpha."

    I then use another form (frmTwo) to add a value to the field, such as "Beta". I current use Forms!frmMain.Information.Value - Me.Information.Value. However, this code replaces "Alpha" with "Beta". How to I get it to say "Alpha Beta"

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Maybe:

    Forms!frmMain.Information & " " & Me.Information
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Forms!frmMain.Information = Forms!frmMain.Information & " - " & Me.Information

    If you are adding data you need to start with the main field each time, then add the new data. You may want to add a Save command after also as it might not save the record on the Main screen.

  4. #4
    zashaikh is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2017
    Posts
    182
    Ah thank you. I tried Forms!frmMain.Information AND " - " & Me.Information. For some reason, I keep forgetting to use &.

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

Similar Threads

  1. Replies: 5
    Last Post: 10-04-2016, 02:05 PM
  2. Replies: 2
    Last Post: 01-10-2016, 06:47 PM
  3. Replies: 6
    Last Post: 05-29-2015, 10:21 AM
  4. Replies: 16
    Last Post: 11-03-2014, 02:38 PM
  5. Extract numbers from text string strored in a field.
    By khabdullah in forum Programming
    Replies: 2
    Last Post: 12-23-2007, 06:55 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