Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Field Values using If Else statements

Discussion in 'Information Technology' started by MJc215, Nov 17, 2005.

  1. MJc215

    MJc215
    Expand Collapse
    Guest

    I want to create a field that has a numeric value that will be
    determined by another already created field called "days out". I want
    the days out field to be worked into an If else statement that will
    enter a value of 1, 2, or 3 based the number of days out field. Can i
    write this directly in the field or should it be done with a function
    that is referenced to the field?????
     
  2. Loading...


  3. Van T. Dinh

    Van T. Dinh
    Expand Collapse
    Guest

    No.

    In fact, calculated values (and it sounds to me the required numeric value
    you want is a calculated value) should not be stored in the Table according
    to the Relational Database Design Theory. Calculated values should
    generally be (re-) calculated when it is needed and not stored!

    --
    HTH
    Van T. Dinh
    MVP (Access)



    "MJc215" <buttauup1@gmail.com> wrote in message
    news:1132175619.273523.10020@g44g2000cwa.googlegroups.com...
    >I want to create a field that has a numeric value that will be
    > determined by another already created field called "days out". I want
    > the days out field to be worked into an If else statement that will
    > enter a value of 1, 2, or 3 based the number of days out field. Can i
    > write this directly in the field or should it be done with a function
    > that is referenced to the field?????
    >
     
  4. tina

    tina
    Expand Collapse
    Guest

    well, unless there is a direct 1 to 1 correlation between [days out] and the
    assigned value (1 [days out] = 1 [assigned value], 2 [days out] = 2
    [assigned value], etc), i would probably use a Select Case statement. for
    example

    Select Case Me![days out]
    Case 1 To 5
    Me![days out] = 1
    Case 6 To 10
    Me![days out] = 2
    Case Is > 10
    Me![days out] = 3
    Case Else
    Me![days out] = 0
    End Select

    you might run the code from the [days out] control's AfterUpdate event
    procedure.

    hth


    "MJc215" <buttauup1@gmail.com> wrote in message
    news:1132175619.273523.10020@g44g2000cwa.googlegroups.com...
    > I want to create a field that has a numeric value that will be
    > determined by another already created field called "days out". I want
    > the days out field to be worked into an If else statement that will
    > enter a value of 1, 2, or 3 based the number of days out field. Can i
    > write this directly in the field or should it be done with a function
    > that is referenced to the field?????
    >
     

Share This Page