Connecting Tech Pros Worldwide Forums | Help | Site Map

How to create call a Module

Familiar Sight
 
Join Date: Nov 2006
Posts: 134
#1: Apr 30 '08
I have many forms, in every form, I need to validate a Process, so instead of coding to every forms, I could think of using module, but not sure how to do it.


(1). In each form how do I call the module to check the Process and (2) return me the result.

The result return would allow me to fire up the next form. For example if result return is "Frmcust"
I would then code frmcust.show


In the module I use to check the process, but not so sure how to write the
proper coding.
Module
if process = "CUST" then
frmName="FrmCust"
elseif process = "VENDOR" then
frmName = "FrmVendor"
elseif process = "STOCK" then
frmName="frmStock
end if

debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#2: Apr 30 '08

re: How to create call a Module


create a procedure and call that where ever you want .
Familiar Sight
 
Join Date: Nov 2006
Posts: 134
#3: May 1 '08

re: How to create call a Module


Quote:

Originally Posted by debasisdas

create a procedure and call that where ever you want .

Do i need to create procedure on every form ?,
daniel aristidou's Avatar
Needs Regular Fix
 
Join Date: Aug 2007
Posts: 493
#4: May 3 '08

re: How to create call a Module


Quote:

Originally Posted by jamesnkk

Do i need to create procedure on every form ?,

Try
Expand|Select|Wrap|Line Numbers
  1. Module Process_procedure
  2. Public Sub(ByVal Cust as Variant)
  3. Dim Formtoopen as form
  4. 'Your if condition
  5.  
  6. Formtoopen.Show
  7. End sub
  8.  
  9.  
  10. 'to call this just type:
  11. 'Replacing Cust with the correct value or :defining it before hand
  12. Call Process_procedure(CUST)
Familiar Sight
 
Join Date: Nov 2006
Posts: 134
#5: May 3 '08

re: How to create call a Module


Quote:

Originally Posted by daniel aristidou

Try

Expand|Select|Wrap|Line Numbers
  1. Module Process_procedure
  2. Public Sub(ByVal Cust as Variant)
  3. Dim Formtoopen as form
  4. 'Your if condition
  5.  
  6. Formtoopen.Show
  7. End sub
  8.  
  9.  
  10. 'to call this just type:
  11. 'Replacing Cust with the correct value or :defining it before hand
  12. Call Process_procedure(CUST)

Thank You so much will try out
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#6: May 5 '08

re: How to create call a Module


Quote:

Originally Posted by jamesnkk

Do i need to create procedure on every form ?,

No ,create a procedure with Public scope and call it anywhere you want within the project.
Reply