Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unanswered: Update Query, Replace Number with Text

    Hi,
    Table 1 has a text field "Field 1 ".
    I need to replace the text "asd_ddd" in "Field 1", with number 32.
    Also replace the text "asd_vvv" in Field 1", ith number 62.
    Can I have one update Query to do this and more replaces.
    What expression in the update query is needed to do this?...
    Cheers

  2. #2
    Join Date
    Feb 2004
    Location
    Wales
    Posts
    343
    Hi,
    Table 1 has a text field "Field 1 ".
    I need to replace the text "asd_ddd" in "Field 1", with number 32.
    Also replace the text "asd_vvv" in Field 1", ith number 62.
    Can I have one update Query to do this and more replaces.
    What expression in the update query is needed to do this?...
    +++++++++++++++++++++++++++++++++++++++
    Hi

    In the Udate Query - Update to, you can put an IIF statement in here so that it reads something like :-IIf([your_table.Field_1]="asd_ddd","32",IIF([your_table.Field_1]="asd_vvv","62",""))

    you can nest the IIF's a number of times but remember that if you need the numbers to change from those set you'l have to look for an input system to do that

    I think the Iff statements are right - I rushed a bit as the soccer was starting and i needed to see liverpool play

    regards
    gareth

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I would write a little function to help with the update, instead of having a nested IIf.

    Public Function ReplaceText(strText As String) As Long

    Select Case strText
    Case "asd_ddd"
    ReplaceText = 32
    Case "asd_vvv"
    ReplaceText = 64
    End Select

    End Function

    Then in the update query update the field to ReplaceText([Field 1]).

  4. #4
    Join Date
    Feb 2004
    Posts
    2

    Re: Update Query, Replace Number with Text

    Thanks .....

Posting Permissions

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