locked
does Dcount in a control still fire if text box not visible? RRS feed

  • Question

  • Hi folks,

    textbox control source:   = "The count is " & Dcount("*", "SomeTable")

    does this fire when the form is opened even if the textbox is not visible?

     don't want the control counting, which takes time, if the user doesn't care to see it.....

    have asked the question a few different ways and can't seem to find an answer online....

    Wednesday, May 8, 2019 10:59 PM

Answers

  • It does. So, modify your code that sets Visible on/off of the textbox to also set its ControlSource to either "" (zero-length string) or:

    "='The count is ' & DCount('*','SomeTable')"


    Gustav Brock

    Thursday, May 9, 2019 7:48 AM

All replies

  • does this fire when the form is opened even if the textbox is not visible?

    Hi msdn…,

    I have not tested this, but I suppose the textbox is filled, even when not visible.

    You could leave the textbox empty, and only fill it in the Click event of the control (or some other command button).

    Imb.

    Thursday, May 9, 2019 7:03 AM
  • It does. So, modify your code that sets Visible on/off of the textbox to also set its ControlSource to either "" (zero-length string) or:

    "='The count is ' & DCount('*','SomeTable')"


    Gustav Brock

    Thursday, May 9, 2019 7:48 AM
  • ok thanks.... couldn't find that definitive statement via search.  Am assigning the control source when the trigger for visibility happens.  a little more messy but in this case appropriate.....
    Thursday, May 9, 2019 1:43 PM