Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Posts
    28

    Unanswered: query convert into near 5

    Hi,
    I need new update query which will convert value
    into near number end with 5

    befor after convert
    2 5
    3 5
    4 5
    6 5
    13 15
    18 20
    23 25
    28 30
    the convert must be
    5,10,15,20,25,30

  2. #2
    Join Date
    May 2002
    Posts
    6

    quick & dirty way

    use a function like this in your query to update the field:

    Public Function Nearest5(x As Single)
    Select Case x
    Case Is <= 7
    Nearest5 = 5
    Case Is <= 12
    Nearest5 = 10
    Case Is <= 17
    Nearest5 = 15
    Case Is > 20
    Nearest5 = 20
    End Select
    End Function

  3. #3
    Join Date
    May 2002
    Posts
    28

    Where i put

    Hi, thanks alot for reply
    Where I put the code i am use access97 plz take some pain and make more clear.


    Again thanks

  4. #4
    Join Date
    May 2002
    Posts
    6

    Re: Where i put

    Originally posted by muzori
    Hi, thanks alot for reply
    Where I put the code i am use access97 plz take some pain and make more clear.


    Again thanks
    muzori:

    save the code into a module

    in your query, the field you wish to convert should read:
    Value: Nearest5([muzori])

    where "muzori" is the name of the field to convert

  5. #5
    Join Date
    May 2002
    Posts
    28

    It work but

    Thanks alot for u I did as u told but
    it did not convert the number near 20.

    thanks again

Posting Permissions

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