Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Functions


Message #1 by "James Potter" <questionaccess@h...> on Wed, 27 Nov 2002 14:50:20
Hi all,

How do I link a piece of 'function code' to a button on a form, so that 
the function is triggered when a button is pressed?

I have tried copying the function to the 'On Click' code of the button but 
access does not like this. I also tried copying the function to a module 
and on the 'On Click' field typing =InstallationDays(), which is the name 
of the function but Access returned a message saying it could not locate 
the function.

Thanks
James
Message #2 by "Steve Klein" <Stephen@K...> on Wed, 27 Nov 2002 14:57:42 -0000
If it is for one place alone:

open the properties of the button - select events
select the builder - just to the right of the white area and showing three
dots ...
select code builder  and it will start a subroutine

myButton_onClick ()

end sub

Insert your code  between these two lines
ensure that [event procedure] now shows in the on click proprty for the
button


If you are going to use it over and over again

create a new module called global procedures
start your function as follows

Global function myfunction()

copy your code in there.

When you go back to your form, in your 'on click' event you caqn now type
'=myfunction() ' and it will be recognised.


Steve K





Steve K


-----Original Message-----
From: James Potter [mailto:questionaccess@h...]
Sent: 27 November 2002 14:50
To: Access
Subject: [access] Functions


Hi all,

How do I link a piece of 'function code' to a button on a form, so that
the function is triggered when a button is pressed?

I have tried copying the function to the 'On Click' code of the button but
access does not like this. I also tried copying the function to a module
and on the 'On Click' field typing =InstallationDays(), which is the name
of the function but Access returned a message saying it could not locate
the function.

Thanks
James

Message #3 by "Kenny Alligood" <kennyalligood@h...> on Thu, 28 Nov 2002 09:58:03 -0500
In your Click Event use this:

          Call InstallationDays

Kenny

----- Original Message -----
From: James Potter
Sent: Wednesday, November 27, 2002 9:42 AM
To: Access
Subject: [access] Functions

Hi all,

How do I link a piece of 'function code' to a button on a form, so that  
the function is triggered when a button is pressed?

I have tried copying the function to the 'On Click' code of the button but  
access does not like this. I also tried copying the function to a module  
and on the 'On Click' field typing =InstallationDays(), which is the name  
of the function but Access returned a message saying it could not locate  
the function.

Thanks
James
to unsubscribe send a blank email to Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com


  Return to Index