Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Thanked 0 Times in 0 Posts

    Calculations in textbox (2002)

    Trying to do a calculation based on a checkbox. Have two questions.

    Trying to write code that will subtract .1 from a number in one textbox and place the result in another textbox. Here is the code. Problem is it won't subtract. If I multiple or divide it it works.

    If Me.chkTournEligible = -1 Then
    Me.TournEligibleScore = Me.txtScore -.1
    DoCmd.RunCommand acCmdRefresh
    ElseIf Me.chkTournEligible = 0 Then
    Me.TournEligibleScore = 0
    DoCmd.RunCommand acCmdRefresh
    End If

    Second question is how do I get the textbox where I want the result to show up to show the answer to one decimal place (78.9) I can get the box to show one decimal place but it only shows 78.0. Is there a textbox property I am not setting or do I have to do something in the above code to get it the way I want it?



  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Mt Macedon, Victoria, Australia
    Thanked 45 Times in 44 Posts

    Re: Calculations in textbox (2002)

    Is TournEligibleScore bound to a field in a table? If so what data type is it?

    It looks to me like you are using an integer data type, which only accepts whole numbers. Change the data type to single to accept decimals.
    The field is still a number, but you need to use the properties of the field to say what type.

Posting Permissions

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