Call function problems

Dachande11

Registered User.
Local time
Today, 23:51
Joined
May 1, 2001
Messages
41
Hello,

I have a form with a command button on it which requeries a load of controls on my form. I also have a popup form which I open from the main form, this popup form contains a list box. My problem is that I would like to call the command46_click (main form) procedure when I click on the list box (popup). I have tried a few different ways such as Call command46_click and [forms]![product].command46_click but neither have worked.

Thanks in advance to anybody who can help.
 
Dachande11,

Make sure that the command46_click() procedure in the main form is declared as Public:

Public Sub Command46_Click()
...
End Sub


Once that is done, you will be able to call the procedure from another form etc...

[forms]![product].command46_click()

or

form_product.command46_click()

Hope that helps,

axa
 
Thanks Axa, but it still doesn't work. I have tried calling the procedure a number of different ways but it either does nothing or brings up an error message depending on which way I try and call it.
 
What is the code in Command46_Click?

When in doubt I always put a MsgBox in place of the actual code so I can tell when I've called it because possibly it is running and failing somewhere. Alternatively you could put BreakPoint in at:

Public Sub Command46_Click

If you type
Forms("Product").Command46_Click
does this not work.

If all else fails move the code from the module into a public sub procedure and call that from both the Pop-Up and Main forms.

Ian
 
Thanks to both of you for your help, I moved the code into a seperate module and called it from the main form and then the popup and found that the code did not work when called from the popup form. I have rectified the code and everything is now o.k.

thanks again

Mark
 

Users who are viewing this thread

Back
Top Bottom