473,573 Members | 2,925 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

call function that written in form from module

158 New Member
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
  3. If bOkClicked Then
  4.  sType = "Rehold "
  5. End If
  7. If bOk1Clicked Then
  8. sType = "MultipleHold"
  9. End If
  11. End Function

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

Kindly help
Mar 22 '11 #1
1 1543
639 Recognized Expert Contributor

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

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

Mar 23 '11 #2

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

Similar topics

by: MLH | last post by:
Would the following work if placed in a form module rather than a global module? Declare Sub InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long)
by: Edward | last post by:
Access 2k FE/BE My application allows users to enter employee hours against rotas (i.e. who is rostered on, and when). They further want a function to output a report showing the number of hours that each employee is rostered, and to be able to do this for any week. To this end there is a control on the "Rota" form which shows the "Week...
by: Lucy Randles | last post by:
I've written a VBA function that I then need to call in a form. Previously to do this I have written the call procedure in the same module as the function - i.e. Function callfunctionname() Call functionname End function However, although the function itself works, the call procedure doesn't. I've tested it in another db just to check...
by: MLH | last post by:
I would like to call a function stored in a form module in Access 2.0 from an Access 2.0 procedure in a global module. Function EmailTheOutletters () in module AppSpecific... .... 560 SSNtext = SelectRandomSSNtext(SSN) .... End Function
by: simonmarkjones | last post by:
I want to call a function which does this when the next record button is pressed (calling it from before update) if textboxes are empty then Message box you must fill text box
by: MLH | last post by:
A97 allows separate procedures in a form module to share common label names. Access 2.0 would puke when that happened. For instance, if I had 2 procedures in an Access 2.0 form module with labels both named ERR_MyButton_Click, compiling loaded modules produced an error. I'm glad to see this is not the case in Access 97. Access 2.0 went so far...
by: shailashri_sk | last post by:
Hello All, Just wanted to know, if there is IDE which provides compilers for diff languages like C, ADA, C++ etc. Can v call the procedures written in C++ or ADA, from these C prgms may be, by some compiler directives to tell, that for this procedure a different compiler is to be used to produre the ..exe file. thanks, Shailu, PS : As I...
by: leaf | last post by:
Hi, How to call function at runtime, based on a struct that contains the information for the function call: struct func_to_call { int function_id; // function id to call unsigned int nparams; // number of parameters unsigned long* parameter; // the parameter(s) to pass }
by: Sullivan WxPyQtKinter | last post by:
In python, these expression seems yields the same result: inputstring='ABC' print inputstring.lower() print lower(inputstring) print string.lower(inputstring) result: abc
by: Steve B | last post by:
Hello, I am trying to create a math function in a module and then call the function from a VB form. For some reason I get errors each time I try. on the VB Form A = 1 B = 2 how do I call the functin below?
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.