Results 1 to 4 of 4

Thread: Access (97)

  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access (97)

    Hi

    Is it possible to include a public declared variable and use it as the control source of a textbox.

    Background
    I have two subforms which each produces a date, which I wish to use in a datediff calculation and display the result in an unbound textbox in the main form. To pass the dates from the subforms to the main form I have used public declaration in a module.

    I'm not even sure whether the method of declaring the dates in the main form is the best way of doing it. Any help would be appreciated.


    Thanks & Regards
    WTH

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Access (97)

    You can access the dates in the subform directly; setting up a public variable doesn't really help. You can actually even reference the control in the subform from the controlsource of that textbox on the mainform.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    181
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access (97)

    Hi

    Thanks for the reply

    I had already tried your suggestion, but it did not work, although it is probable that I used incorrect syntax. Therefore, would it be possible to give me an indication of the correct syntax to use.

    Thanks for the help

    Regards
    WTH

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Access (97)

    Okay. Let's assume your mainform is named [MyMainForm]. I don't care what your subform itself is named, however let's assume the subform control that resides on the mainform is named [subControl]. And on the subform itself there is a textbox containing the data you want, so let's call this [txtDate]. Your controlsource for a textbox on the mainform would be:

    =Forms![MyMainForm].[subControl].form.[txtDate]
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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