how to execute code 
Author Message
 how to execute code

How do I get a module to exacute in a form?



Mon, 24 Jul 2000 03:00:00 GMT  
 how to execute code

In the on open property (or whichever one you need to use) click the builder
button and use the expression builder and choose the code from within the
built-in functions options and from there choose your piece of code.

Andy

Quote:
>How do I get a module to exacute in a form?



Mon, 24 Jul 2000 03:00:00 GMT  
 how to execute code

A Module, you don't.
A SUB in a Module,  Just call it, Say your Module looks like :

Sub SayHi()
msgbox "Hi"
End Sub

Then in your Form, on whatever event you like, go into the code builder and
put :

SayHi
or
Call SayHi

IF it's a Function you have,  It's almost the same, but a Function returns a
value so it would be more like :

Function SayHi()
On Error Goto SayHi_Err
  MsgBox "Hello World"
  SayHi = True
Exit Function
  SayHi_Err:
  Function = False
End Function

If the Form, you code could look like this :

Sub ButtonX_Click()
  Dim X as Integer
  X = SayHi()      'this will cause SayHi to Run
  Debug.Print X   'Puts in the Debug Window if SayHI Ran Ok
End Sub

--
\                                           /
  \   Brian Mailloux              /

/                                          \

Quote:
>How do I get a module to exacute in a form?



Mon, 24 Jul 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Screen refresh while executing code?

2. Force a form to display before executing code.

3. How to execute code for test

4. How to execute code when I open a mail

5. Automatically Execute Code

6. Howto: draw the form before executing code

7. form.show - > execute code

8. Stop executing code

9. Q: how to execute code at a preset time?

10. How do I execute code when the Exit Control box is clicked?

11. Executing SQL Server DTS package in VBA code

12. Execute Code at Same Time Everyday

 

 
Powered by phpBB® Forum Software