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

kirubagari
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
  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 1543
MikeTheBike
639 Recognized Expert Contributor
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

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

Similar topics

9
3000
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)
0
1819
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...
5
652
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...
2
5602
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
9
3366
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
2
1441
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...
10
1680
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...
12
5767
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 }
4
1452
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
9
1664
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?
0
7771
marktang
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...
1
7771
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...
0
6406
agi2029
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...
1
5580
isladogs
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...
0
5289
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...
0
3730
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...
0
3731
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1296
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1036
bsmnconsultancy
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.