Having to cut/paste/save VBA code for it to work

  • Thread starter Thread starter gawime
  • Start date Start date
G

gawime

Guest
I am writing some Code for a Form

it has elements like

cmdok_click ()
cmdcancel_click ()
lstblah_dblclick ()
etc...

Each section of code works, but with a weird caveat. In order to make the code work, I need to cut it, then paste it, then save it. Once I do that the code does what I intended it do.

If I don't cut/paste/save the VBA code once I open the database, parts of the code don't work at all. It doesn't give me errors, but the code doesn't work. For example, the cmdcancel_click will work, but if I double click the lstblah the lstblah_dlblick() won't even be called.

Any ideas whats going on?
 
This sounds like it may be something I have encountered before. If you copy and paste code into a form module, it does not appear to always draw the proper connection with the event that is supposed to activate it.

If you look at the event properties of your control (cmdOK for instance), make sure that it reads [Event Procedure] in the desired event. If it does not, select [Event Procedure] from the dropdown and click the ... to go to your module. After you save your changes, this event should act as expected going forward.
 
Thanks a bunch

That fixed the problem. Thanks a bunch.
 

Users who are viewing this thread

Back
Top Bottom