472,143 Members | 1,161 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

call function that written in form from module

kirubagari
158 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
1 1405
MikeTheBike
639 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
12 posts views Thread by leaf | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.