467,136 Members | 1,393 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,136 developers. It's quick & easy.

call function that written in form from module

kirubagari
100+
Dear expert,

i had written the code in my form

Expand|Select|Wrap|Line Numbers
  1. Public Function HoldType(ByRef sType As String) As String
  2.  
  3. If bOkClicked Then
  4.  sType = "Rehold "
  5. End If
  6.  
  7. If bOk1Clicked Then
  8. sType = "MultipleHold"
  9. End If
  10.  
  11. End Function
  12.  
  13.  

i want to call it in my module as below
Expand|Select|Wrap|Line Numbers
  1. Public Function HoldReleaseLot(sActionType As String) As String
  2.  
  3. Call HoldType ()
  4.  
  5.  
i unable to perform this..What is the method calling function that written in form in module

Kindly help
Mar 22 '11 #1
  • viewed: 1277
Share:
1 Reply
Expert 512MB
Hi

You do not indicate what application you are running the code in, but, on the basis that the form is open, then, if its Excel or Access (and I suspect .NET or any other language?) then you need to refer to the form Object/Class by name something like this

In Excel
Expand|Select|Wrap|Line Numbers
  1. Public Function HoldReleaseLot(ByRef sActionType As String) As String
  2.     UserForm1.HoldType sActionType
  3. End Function
In Access like this
Expand|Select|Wrap|Line Numbers
  1. Public Function HoldReleaseLot(ByRef sActionType As String) As String
  2.     Form_YourFormName.HoldType sActionType
  3. End Function
OR like this
Expand|Select|Wrap|Line Numbers
  1. Public Function HoldReleaseLot(ByRef sActionType As String) As String
  2.     Forms("YourFormName").HoldType sActionType
  3. End Function
HTH

Note sure what the ultimate doing, but as it stands both HoldType and HoldReleaseLot could be a Subs rather that a Functions!?

MTB
Mar 23 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Lucy Randles | last post: by
9 posts views Thread by simonmarkjones@gmail.com | last post: by
10 posts views Thread by shailashri_sk@sify.com | last post: by
12 posts views Thread by leaf | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.