Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Replace piece of memo field (2003)

    I'm trying to replace generic information within a memo field, either by a make table or update query. Ex. some memo fields have <Activity> within the text. I'm wanting this <Activity> to be replaced with a form combo box selection prior to going to print report.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replace piece of memo field (2003)

    Create a query based on the table.
    Add the memo field to the query grid.
    Select Query | Update Query
    In the Update To line, enter

    Replace([NameOfMemoField],"<Activity>",[Forms]![NameOfForm]![NameOfComboBox])

    with the appropriate names substituted. The form must be open when you run the query.

  3. #3
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace piece of memo field (2003)

    Thanks much, Hans. Works perfect

  4. #4
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace piece of memo field (2003)

    HansV, can this expression be strung together allowing multiple replacements within one query of the same field. Having trouble making that work.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Replace piece of memo field (2003)

    It's possible, but it quickly becomes unreadable. It might be better to run several update queries. Examples of multiple replacements:

    2 replacements:
    Replace(Replace([MyMemo],"<Activity>",[Forms]![frmTest]![cboActivity]),"<Location>",[Forms]![frmTest]![cboLocation])

    3 replacements:
    Replace(Replace(Replace([MyMemo],"<Activity>",[Forms]![frmTest]![cboActivity]),"<Location>",[Forms]![frmTest]![cboLocation]),"<Gender>",[Forms]![frmTest]![cboGender])

  6. #6
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Replace piece of memo field (2003)

    Thanks again HansV.

Posting Permissions

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