• Requery controlsource (2000(sr3))

    Author
    Topic
    #450139

    I have two unbound textboxes on a form. The first is for entering a year, the second has as its controlsource a function a function that turns that year into a date, Jan 1 of the following year. Eg. box 1 = 1997, box 2 is calculated to Jan 1, 1998

    In certain circumstances, I need to change the value in box 1 through VBA and then recalculate box 2. I can’t get box 2 to recalculate properly. I’ve tried Me.box2.Requery and I get #Name? I’ve tried calling the function in code with the same problem. How do I get the function to be called to reflected the changed value of box 1?

    Viewing 1 reply thread
    Author
    Replies
    • #1105306

      If you set the Control Source of box2 to

      =DateSerial([box1]+1,1,1)

      it should be recalculated automatically when box1 is updated, whether manually or through code.

      • #1105318

        Thanks to both of you. I got it going in a roundabout way through the code.
        My controlsource is a custom function that does exactly what both of you suggest. So, I’ll try it your way which is more elegant and if it still won’t work properly, I can always revert to my less elegant way.

    • #1105308

      You should not need to do anything at all to get box to recalculate. It should happen automatically.

      What is the control Source of Box2? =DateSerial([box1]+1,1,1)

      Have a look at the attachment.

    Viewing 1 reply thread
    Reply To: Requery controlsource (2000(sr3))

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

    Your information: