473,320 Members | 2,111 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,320 software developers and data experts.

function calling another function

2
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 4097
Rabbit
12,516 Expert Mod 8TB
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 Expert 100+
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 Expert 8TB
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
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
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...
1
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...
5
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...
8
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...
6
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
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...
15
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...
3
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...
9
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.