Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    83

    Unanswered: rounding to nearest ten, and a switchboard question

    Hi,

    I am a novice to Access, I need your help.
    I have three questions,
    The value entered in a text field in one of my form, should be rounded to nearest ten. For example, if the user enter the value as 134, it should rounded to 130, and if the user enter say 158, the value should be rounded to 160. how can we achieve this rounding.

    And the second one, I want to set a value for a field B based on the value entered in field A.

    One last question, I have created the switchboard, (from the Tools menu...Database Utilities...Switchboard Manager), and is the default switchboard. All the items are in there, when I view them in Switchboard manager. What I am confused is, the Switchboard form are not showing up under forms, and also the Switchboard Items are not showing up under tables. am I missing some steps here?

    Any clue or help is really appreciated.
    Thanks in advance.

  2. #2
    Join Date
    Nov 2003
    Location
    Melbourne Victoria Australia
    Posts
    7

    Rounding to Ten

    To get the rounding

    dim x as integer

    x = in_number / 10
    in_number = x * 10
    Last edited by Muggins; 11-19-03 at 20:20.

  3. #3
    Join Date
    Nov 2003
    Location
    Melbourne Victoria Australia
    Posts
    7

    Setting a Value from another

    You could use the LostFocus of FieldA or the BeforeUpdate

    eg.
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    .
    .
    .
    FiledB = FieldA * 1.10
    .
    .
    endsub

    You may want to make FieldB enabled = No and/or Locked = Yes

  4. #4
    Join Date
    Sep 2003
    Posts
    83

    Re: Setting a Value from another

    Originally posted by Muggins
    You could use the LostFocus of FieldA or the BeforeUpdate

    eg.
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    .
    .
    .
    FiledB = FieldA * 1.10
    .
    .
    endsub

    You may want to make FieldB enabled = No and/or Locked = Yes
    -----------------------

    Thanks I got the second question right with the help of you.

    The rounding to nearest ten was achieved by the following:

    In the lostfocus event of textA

    Dim X as integer
    x = (Round(txtA / 10) * 10)
    txtA = x

    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
  •