Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing a Value (Access 2002)

    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.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Passing a Value (Access 2002)

    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:

    <pre>Private Sub TestText1_AfterUpdate()
    Dim dblEntered as Double

    dblEntered = [TestText1]
    If dblEntered > 8 Then
    [TestText2] = dblEntered - 8
    [TestText1] = 8
    End If
    End Sub</pre>


    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.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Passing a Value (Access 2002)

    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.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Passing a Value (Access 2002)

    Then calculate the values in the AfterUpdate event of the TimeOut control.
    <hr>These will be dimmed and no tab<hr>
    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.
    Charlotte

Posting Permissions

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