473,396 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

call VBA function in access

232 100+
Kindly help me how to write and call VBA function in access
I want to print simple hi function with VBA programming
VBA function is not working correctly and asks for parameter value and after giving any rough value such as a then print #name?
I write the function by clicking view code
Expand|Select|Wrap|Line Numbers
  1. Sub hum()
  2. prn.Text = "hi"
  3. End Sub
On textbox with name prn I write
=hum()
But a popup box opens and ask for Enter parameter value
Kindly help
Thanks in advance
May 2 '12 #1
4 8527
NeoPa
32,556 Expert Mod 16PB
prn is not defined.

Please read Before Posting (VBA or SQL) Code. I expect it may help you.
May 2 '12 #2
Mihail
759 512MB
While I am not sure what you are looking for I can't be sure that this is a good answer:

Use a Function, not a Subroutine;
Put this function in a regular module (not a form or a report module).
Declare the function as Public:
Expand|Select|Wrap|Line Numbers
  1. Public Function Hum() As String
  2.     'Set the returning value
  3.     Hum =  "hi"
  4. End Sub
Now, use the function in your text box: = Hum()
May 3 '12 #3
TheSmileyCoder
2,322 Expert Mod 2GB
Allthough not directly related to the errors in your code, I think you may find the following link usefull:
http://bytes.com/topic/access/insigh...-access-2003-a

It explains how to write and use a function from within access VBE, and shows a few ways of calling said function from your form/query/code.
May 3 '12 #4
Mihail
759 512MB
Good work Smiley!
If you can add an example about how to use this in a report too I think will be fully complete.

For now I wish to inform kkshansid that the technique for reports is exactly the same with the technique for forms.
May 3 '12 #5

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

Similar topics

5
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...
2
by: PawelR | last post by:
Hello Group, In my application I have few class, and I want call function with "master class". This is as master form (startClass) and option window (ClassA). My question is how call function...
4
by: Dave | last post by:
I have a program that I've written a class for. I need to call the function in the program from the class. When I try to call the function I receive the error, the name xxx does not exist in the...
2
by: moondaddy | last post by:
I'm using vb.net and have an aspx page where I want to call a function in the code behind to do something on the backend and I want to call this function from a jscript function in the aspx page. ...
7
by: Tiraman | last post by:
Hi , I have 3 files , middle.aspx file include the header.aspx and footer.aspx files . in each of the include files there is a function and from some reason the call to the Footer() function...
0
by: ss | last post by:
i read a few posts about global function access. well i am not interested in global functions. rather, i am seeking for a way to may my call in ASPX pages but not the code behind. for example:...
12
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;...
1
by: Khai Doan | last post by:
I have function A, which need to call function B with the exact same argument list. What is the correct way to do this? I had function A: function A { B(arguments); } but it does not...
3
by: dolphin | last post by:
Hello everyone! Can a static member function access non-static member? I think it is illegal.Is it right?
1
by: intermanch | last post by:
how call function php($varible) into javascript withod ajax: <!-- this code only call funnctions php but how call function php intermanch@gmail.com www.intermanch.blogfa.com
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.