Results 1 to 6 of 6
  1. #1
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480

    Help with Replace Function...

    I have a textbox on a form, its value is determined by a record...

    Forms("frmmainnew").Text311.Value = r![F3]

    That is working great... but here is the problem. The data from that record is always formatted like this...

    ", 38972,"

    I need to have it formated like this

    "38972;"

    SO I need the leading ", " dropped. Then all the following ", " turned into ";"

    I have tried this...



    Forms("frmmainnew").Text311.Value = Replace(r![F3], ", ", ";")

    but this changes the text box to this.

    ;38972,


    any ideas?

  2. #2
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    hows this do for ya?

    Forms("frmmainnew").text311.value = val(r![F3])

  3. #3
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    It left me with a 0 in the textbox field.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about:
    Forms("frmmainnew").Text311.Value = Replace(r![F3], ",", "") & ";"

  5. #5
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    beautiful, thank you both. Working great now!

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Glad we could help.

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

Similar Threads

  1. Replies: 1
    Last Post: 11-30-2012, 05:57 AM
  2. Error with Replace Function
    By Juan4412 in forum Queries
    Replies: 1
    Last Post: 09-30-2012, 05:48 PM
  3. Replies: 3
    Last Post: 06-07-2012, 07:05 AM
  4. Replace Function with Table Lookup
    By smurof in forum Access
    Replies: 1
    Last Post: 07-29-2011, 07:52 PM
  5. Applying a find/replace function
    By Arr in forum Programming
    Replies: 2
    Last Post: 10-12-2009, 12:28 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