473,809 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

function calling another function

2 New Member
In MS Access i have a function that is calculating the distance between two locations using the latitude and longitudes for two points assuming the earth is flat and the lat and long are perpendicular. I called that function distance. My issue in moving forward is taking the distance i am given from the above function and bringing it into another function i call function wp. I would like to say if the distance is less than 300 then calculate this formula or if it is less than 500 calculate another, less than 1000 another, and so on. I am having issues with my second function calling the distance function and then running certain formulas for each case

Any help would be great
Dec 11 '07 #1
3 4148
Rabbit
12,516 Recognized Expert Moderator MVP
Assuming that you can't combine both functions and that you can't call one function from the other, you just need to store the result of the first function using whatever method you want and then pass it to the second function as a parameter.

From the sounds of the first function, you seem to know how to pass parameters and have functions return values. So it's not that much harder to just store the result of the first function either temporarily or permanently and then pass it to the second function.

So unless I've misunderstood something, it sounds like you should have enough knowledge to do this.
Dec 11 '07 #2
Minion
108 Recognized Expert New Member
From what I can tell here unless you need to call the distance function for another reason you should be able to combine the two into one function. The best way for this would be to use "SELECT CASE" to determine which formulas to run. The code would be something like:

Expand|Select|Wrap|Line Numbers
  1. x = <distance>
  2.  
  3. Select Case x
  4.     Case <parameter>
  5.          <code for case>
  6.     Case <parameter>
  7.           <code for case>
  8. End Case
  9.  
This should allow you to calculate the distance and store it in "x" then by setting up the criteria in the "Select Case" it should execute the proper code or formula for each distance.
Dec 11 '07 #3
ADezii
8,834 Recognized Expert Expert
In MS Access i have a function that is calculating the distance between two locations using the latitude and longitudes for two points assuming the earth is flat and the lat and long are perpendicular. I called that function distance. My issue in moving forward is taking the distance i am given from the above function and bringing it into another function i call function wp. I would like to say if the distance is less than 300 then calculate this formula or if it is less than 500 calculate another, less than 1000 another, and so on. I am having issues with my second function calling the distance function and then running certain formulas for each case

Any help would be great
Unless the logic and coding are more complex than what originally appears, why export the Return Value of Function 1 to Function 2 for a final analysis? Why not keep all the code In-Line?
Dec 12 '07 #4

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

Similar topics

6
5329
by: Eric Entressangle | last post by:
Hi all, is there any trouble setting an C++ static class method as callback function for a C program or library ? Thanks
17
43964
by: Roland Hall | last post by:
Is there a way to return multiple values from a function without using an array? Would a dictionary object work better? -- Roland Hall /* This information is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. */ Technet Script Center - http://www.microsoft.com/technet/scriptcenter/ WSH 5.6 Documentation -...
1
2539
by: Foxy Kav | last post by:
Hi everyone, im a first year UNI student doing a programming subject and im stuck on how to get rid of my global variables, char stringarray and char emptystring. I was wondering if anyone could show me a example of how to do this. I was told to pass the arrays from function to function, but i do not know how .... Thanxs if you can help. My code (First two functions only - there's more):
5
2158
by: amit kumar | last post by:
I am calling a function which returns pointer to a map. The declaration of the map is map<int,vectxyz*>. vectxyz is a vector containing pointer to a class xyz. For map<int,vectxyz*>* p1 In the called function, I am using p1->find(1) which is returning a valid iterator and not going to the end. I am returning p1 from the called function. But in the calling function, find(1) is going to the end, i.e unable to find the key 1, which was...
8
2968
by: Muthu | last post by:
I've read calling conventions to be the order(reverse or forward) in which the parameters are being read & understood by compilers. For ex. the following function. int Add(int p1, int p2, int p3); The parameters here can be read either in the forward order from p1 till p3 or reverse order from p3 till p1. Can anyone explain what is the advantage/disadvantage of either of
6
3496
by: pakis | last post by:
I am having a problem of pure virtual function call in my project. Can anyone explaine me the causes of pure virtual function calls other than calling a virtual function in base class? Thanks
11
2747
by: Felix Kater | last post by:
Hi, I can compile and run this code (see below) which twice calls the function f, first with too less, second with too much arguments. But is it legal and free of memory leaks and other problems? Of course, I presume that inside f I don't access i in case it was called via g. int f(int i){ /* ... */ return 0; }
15
22872
by: dspfun | last post by:
Hi, Is it possible to print the function name of the calling function? For example, f1() and f2() both calls f3(), in f3() I would like to print the name of the function calling f3() which could either be f1() or f2(). BRs!
3
1876
by: william | last post by:
My situation is here: an array of two dimension can only be defined locally within a function(because the caller don't know the exact size ). Then the question is: how should the caller access this array for future use? The code is: ********************** caller() {
9
23777
by: Morten Lemvigh | last post by:
Is it possible to pass a pointer to a constructor or a class definition as argument to a function? Maybe in a way similar to passing function pointers...? The function should construct a number of objects using the given constructor. The objects should all inherit from a base class. It's not possible to pass actual objects, since it's not given on beforehand, how many should be created.
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10635
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10378
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
7653
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.