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?
Module
Function Add (A,B)
Add = A + B
End Function
9 1659
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?
Module
Function Add (A,B)
Add = A + B
End Function
the functions are public by default, any way, specify it, just to make sure, you should also change the functions name, since Add is a method.
may be this will do: - Public Function MyAdd(A, B)
-
MyAdd = A + B
-
End Function
Also check the event's sub where you're calling it from.
HTH
the functions are public by default, any way, specify it, just to make sure, you should also change the functions name, since Add is a method.
may be this will do: - Public Function MyAdd(A, B)
-
MyAdd = A + B
-
End Function
Also check the event's sub where you're calling it from.
HTH
Thank you for the help. How do I call MyAdd in the VB5 form?
Thank you for the help. How do I call MyAdd in the VB5 form?
Here is the code from the Sub on the main form,
Private Sub Command2_Click()
Dim A, B, x
Dim MyAdd
A = 2
B = 2
Label11.Caption = Format(MyAdd, "##0.0")
It will not return a value to label 11.
Here is the code from the Sub on the main form,
- Private Sub Command2_Click()
-
-
Dim A, B, x
-
'Dim MyAdd <-- no need to do this
-
A = 2
-
B = 2
-
-
Label11.Caption = Format(MyAdd(A,B), "##0.0") 'Call the function properly
-
end sub
HTH
- Private Sub Command2_Click()
-
-
Dim A, B, x
-
'Dim MyAdd <-- no need to do this
-
A = 2
-
B = 2
-
-
Label11.Caption = Format(MyAdd(A,B), "##0.0") 'Call the function properly
-
end sub
HTH
To: HTH, thank you provided the information that I needed.
To: HTH, thank you provided the information that I needed.
HTH = hope that helps.
call me Kad,
HTH = hope that helps.
Hahaha... last year I was calling someone "Tia" for a while, not realising it was short for thanks in advance.
Hahaha... last year I was calling someone "Tia" for a while, not realising it was short for thanks in advance.
Just for you not to feel bad, 'Tía' means 'aunt' in Spanish. And in Spain (not in Mexico), they call friends Tío (he) or Tía (she), it's like saying buddy.
In this case, the poster had simply put TIA at the end meaning Thanks In Advance, and I misinterpreted it. But thanks for trying... :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Penn Markham |
last post by:
Hello all,
I am writing a script where I need to use the system() function to call
htpasswd. I can do this just fine on the command line...works great
(see attached file, test.php). When my...
|
by: Edvard Majakari |
last post by:
Greetings, fellow Pythonistas!
I'm about to create three modules. As an avid TDD fan I'd like to create
typical 'use-cases' for each of these modules. One of them is rather large,
and I wondered...
|
by: James Fortune |
last post by:
Here is an example of Access creating a single page PDF file. The
text in the textbox is scaled to fit horizontally into a grey box 100
pixels wide that is fontsize pixels high. Clicking the...
|
by: Lumpierbritches |
last post by:
I have code that is currently placed in the OnClose Event, and it's duplicated
in multiple forms, I would like to convert it to a module and call that module
instead of copy and pasting the code....
|
by: Richard Hollenbeck |
last post by:
Back in the old days before I started learning about menubars (the day
before yesterday,) I based all my operations on command buttons on the
forms. Now the forms are all cluttered up with buttons...
|
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...
|
by: deko |
last post by:
I have a function with a number of long loops. While the function is
running, I want to be able to click a Stop button and exit the function as
quickly as possible.
The abbreviated code looks...
|
by: tech.rawsteak |
last post by:
I have a function that retrieves a user's login name from their
workstation and looks it up on an employee table to return their full
name (ie: jsmith -John Smith). Their full name is then...
|
by: RandomElle |
last post by:
Hi there
I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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...
|
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...
|
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: 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...
| |