Get form field value via module [VBA]

前端 未结 3 1453
走了就别回头了
走了就别回头了 2021-01-27 06:25

I have a program built with VBA, in access. I have a form with the field chDate and I need to get the value of the field in a module file named Global (not class module).

<
3条回答
  •  走了就别回头了
    2021-01-27 06:43

    As far as I know, you're trying to get the data the wrong way.

    Anytime you would try to get your form data, from a standard module, your form probably will already be closed or, if you're not opening it as a restricted window, the value will not be ready yet.

    Anyway, if you could get pass through all the difficulties above, you're probably coding in a not standard / right way.

    Remember that VBA is an event driven language, and you would be better using it's strenghts rather than fighting against them.

    As a final word, if this is just a casual coding, I suggest you using a global variable and make de Code Behind Form have set it up on control's change event.

    If you're not sure what I mean, please leave a comment and I'll try to explain it better.

    And, if you don't mind, let us know more about your starting code to get better answers.

提交回复
热议问题