call user defined function on button click

AunN

Registered User.
Local time
Today, 10:23
Joined
Dec 10, 2011
Messages
16
Dear Programmers!

I want a help, as i m trying to call a user defined function on button call on form but i am not successful yet. Please give me some solution to this problem!!

I will be highly obliged to u all!
 
The easy answer first:
If it has no parameters -
Code:
Private Sub CommandButtonNameHere_Click()
   NameOfProcedureYouAreCallingHere
End Sub

If it has parameters:
Code:
Private Sub CommandButtonNameHere_Click()
   NameOfProcedureYouAreCallingHere "ParameterHere", "SecondOneHere"
End Sub

What is the procedure you are trying to call? What is its code?
 
Can you show us the signature, that is the first line of the function?

It should be something like this:
Code:
Public Function SomeFunction()
That's the line we would like to see.

Edit: I'm pretty slow huh Bob :p :)
 
Can you describe to us what you have done so far? And what is the name of the function and the button? Without any further information I can't be of much help.

I can say that roughly the steps are to create your function, then in the OnClick event for your button you will need to call the function.

Example:

Code:
Private Sub myButton_Click()
     Call myFunction()
End Sub

I think the word Call is optional IIRC, but I usually include it for readability.
 
Yikes, I'm slower than I thought, there were no replies when I started mine.
 
I've seen this happen before ;)

Happens fairly frequently.

chickenbeatnik.jpg
 
@boblarson: Haha! I'll blame it on the Super Mods putting a delay on the posts so that their posts can come first :D Kidding of course ;)
 
Thanku programmers for the inputs it's done!
 

Users who are viewing this thread

Back
Top Bottom