Event not Firing in MS Access VBA

前端 未结 2 1896
梦毁少年i
梦毁少年i 2021-01-27 13:18

I have a form in MS Access which has an image. The image has an Click event which opens a modal form. The modal form has an OK and Cancel button. When you click the OK button

2条回答
  •  甜味超标
    2021-01-27 13:46

    well I don't agree to

    "While VBA does support WithEvents/RaiseEvent, there's no reason to get that complicated here."

    I have worked on various VB6 and VBA project. Recently I coded VBA in excel where I raised an event from winform. Few things to be considered when doing so.

    1. If you are calling non-modal winform in VBA with withevents/raiseevent. It should work normally as expected. No major workaround is needed
    2. If you are calling modal winform in VBA. Withevents/raiseevents may not function as per requirement. A quick workaround is to transfer data using public variables declared in the module file.

    You will need to use the workaround and I believe it will work absolutely fine.

提交回复
热议问题