• Passing a Value (Access 2002)

    Author
    Topic
    #360698

    Hi,

    I haven’t seen this question posted before so I hope someone can help me.

    I would like to know if there is a way to control the value that is passed to a Bound Control.

    I am doing time calculations and when a value that is UP to 8 pass the 8 to one Bound Control and anything over would pass to another Bound Control. i.e. if the value being passed is between .25 and 8 it would go to BoundControl1. If the value being passed is 8.25 or higher then BoundControl1 would recieve the 8 and BoundControl2 would recieve everything above the 8, in this example, .25?

    If this can be done, could someone please help me with this.

    Thanks in advance.

    Viewing 0 reply threads
    Author
    Replies
    • #543739

      Roberta,

      I don’t have 2002 installed yet, but bound controls are the same regardless of version. What do you mean by the value “passed” to a bound control. Normally, the user enters a value into a bound control. If you have to control how the data gets distributed, then the easiest way would be to use the afterupdate event of the first bound control, modifying the value the user entered and inserting the difference into the second control. Something like this:

      Private Sub TestText1_AfterUpdate()
        Dim dblEntered as Double
      
        dblEntered = [TestText1]
        If dblEntered  > 8 Then
          [TestText2] = dblEntered  - 8
          [TestText1] = 8
        End If
      End Sub

      However, unless you’re controlling what gets entered into the second control, your users will be able to muck up the results by overwriting the second control, so you would need a beforeupdate event procedure in the second control to test its value, oldvalue and the value of the first control just to keep everything straight.

      • #543743

        Good Morning Charlotte,

        I have 4 BoundControls…1)TimeIn, 2)LunchOut, 3)LunchIn, and 4)TimeOut.

        I have 2 other BoundControls, 1)RegTime and 2)OTime. What I need to do is calculate the daily time. BoundControl1 will recieve the total of DailyTime. BoundControl1 will recieve NO higher value than 8. If the Daily Time calculates to more than 8 then BoundControl1 will receive 8 and then BoundControl2 will receive the remaining amount.

        I hope this is more clear and I apologize for being vague.

        Thanks for your help.

        p.s. The users won’t have access to BoundControl1 and BoundControl2. These will be dimmed and no tab.

        • #543774

          Then calculate the values in the AfterUpdate event of the TimeOut control. [indent]


          These will be dimmed and no tab


          [/indent]Sorry, but I’m not sure what you mean here. Do you mean that they’re disabled? In that case, you won’t be able to set their values. Instead, set their visible property to false. That way they’ll be hidden but you can still set the values. Or if you want the employees to see them, just set their locked property to true. They won’t be able to write to them, but you can still do it from code.

    Viewing 0 reply threads
    Reply To: Passing a Value (Access 2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: