473,387 Members | 1,535 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,387 software developers and data experts.

function with variables from different forms

I wrote a simple funtion to automatically compute corrected azimuths
in several places in a database but am having trouble implementing it.
I placed the function in a module and am trying to pass to it three
variables: magnetic declination, compass degrees and declination
direction (east or west). The idea is that a user will enter the
current magnetic declination and direction in a form and have those
parameters apply to other forms (where the unique ids match).

How do I pass the variables to the function in the module and have the
function result passed back to the correct text box on the form?

I tried calling the function simply by placing
"=f_compute_true_magnetic([frm_sample_event].[current_mag_dec_direction],[Me].[azimuth_magnetic],[frm_sample_event].[current_mag_declination])"

in the form load event line in the properties of my form. I also
placed this line in the After Update event for object
(azimuth_magnetic) I'm trying to update on form. And it's not
working. The "frm_sample_event" is where the mag dec and direction
are entered.

I also tried putting the function in the code for the form and
entering:
azimuth_corrected = f_compute_true_magnetic([frm_sample_event].[current_mag_dec_direction],
[Me].[azimuth_magnetic], [frm_sample_event].[current_mag_declination])

in the Form Load event but I get an error when I try to open that form
from the frm_sample_event.

Thanks for any help you can offer.

Doug in Alaska
Nov 12 '05 #1
2 3112
Databases are about stored data, and you didn't give us much information
about how you've stored your data. Nor did you indicate how you wanted to
invoke the function -- whether from code, or as the ControlSource of a
Control or ???.

Let's assume the former:

In the Click event of a Command Button on the form where the arguments are
in Controls named, txtMD, txtCD, and txtDD, call your Azi function as
follows:

CorrAz = Azi(Me!txtMD,Me!txtCD,Me!txtDD)

If in Control Source, then we'll assume your form is frmF, the Control
Source would be:

= Azi(Forms!frmF!txtMD,Forms!frmF!txtCD,Forms!frmF!t xtDD)

The "apply to other forms" would mean that you'd make sure the record was
saved using Me.Dirty = False, and then Requery the other forms -- if they
are all bound.

I trust you aren't planning on storing redundant data that you could as
easily calculate when you need to use or display it.

Larry Linson
Microsoft Access MVP

"Wilder" <Do*********@nps.gov> wrote in message
news:b2*************************@posting.google.co m...
I wrote a simple funtion to automatically compute corrected azimuths
in several places in a database but am having trouble implementing it.
I placed the function in a module and am trying to pass to it three
variables: magnetic declination, compass degrees and declination
direction (east or west). The idea is that a user will enter the
current magnetic declination and direction in a form and have those
parameters apply to other forms (where the unique ids match).

How do I pass the variables to the function in the module and have the
function result passed back to the correct text box on the form?

I tried calling the function simply by placing
"=f_compute_true_magnetic([frm_sample_event].[current_mag_dec_direction],[Me
].[azimuth_magnetic],[frm_sample_event].[current_mag_declination])"
in the form load event line in the properties of my form. I also
placed this line in the After Update event for object
(azimuth_magnetic) I'm trying to update on form. And it's not
working. The "frm_sample_event" is where the mag dec and direction
are entered.

I also tried putting the function in the code for the form and
entering:
azimuth_corrected = f_compute_true_magnetic([frm_sample_event].[current_mag_dec_direction], [Me].[azimuth_magnetic], [frm_sample_event].[current_mag_declination])

in the Form Load event but I get an error when I try to open that form
from the frm_sample_event.

Thanks for any help you can offer.

Doug in Alaska

Nov 12 '05 #2

"Wilder" <Do*********@nps.gov> wrote in message
news:b2*************************@posting.google.co m...
I wrote a simple funtion to automatically compute corrected azimuths
in several places in a database but am having trouble implementing it.
I placed the function in a module and am trying to pass to it three
variables: magnetic declination, compass degrees and declination
direction (east or west). The idea is that a user will enter the
current magnetic declination and direction in a form and have those
parameters apply to other forms (where the unique ids match).

How do I pass the variables to the function in the module and have the
function result passed back to the correct text box on the form?

I tried calling the function simply by placing
"=f_compute_true_magnetic([frm_sample_event].[current_mag_dec_direction],[Me
].[azimuth_magnetic],[frm_sample_event].[current_mag_declination])"
in the form load event line in the properties of my form. I also
placed this line in the After Update event for object
(azimuth_magnetic) I'm trying to update on form. And it's not
working. The "frm_sample_event" is where the mag dec and direction
are entered.

I also tried putting the function in the code for the form and
entering:
azimuth_corrected = f_compute_true_magnetic([frm_sample_event].[current_mag_dec_direction], [Me].[azimuth_magnetic], [frm_sample_event].[current_mag_declination])

in the Form Load event but I get an error when I try to open that form
from the frm_sample_event.

Thanks for any help you can offer.

Doug in Alaska

Visit the official MVP site:
http://www.mvp.org
Kelly Rees-Danforth, MVP
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
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...
13
by: Larry L | last post by:
I have a Module that declares several arrays as public, some string, some integers. I then have 2 forms. Form A is the main form, that loads on start-up, and has a command button to open Form B. On...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
9
by: Max | last post by:
I'm new with Javascript and can't seem to figure out what I'm doing wrong here as I'm not able to pass a simple variable to a function. In the head of doc I have: <script...
38
by: Lasse Vågsæther Karlsen | last post by:
After working through a fair number of the challenges at www.mathschallenge.net, I noticed that some long-running functions can be helped *a lot* by caching their function results and retrieving...
4
by: Mike MacSween | last post by:
It's a form, with (so far) 4 tab pages on it, each of which holds 2/3/4 subforms. (I like tabbed forms by the way - do we all?) Basically the subforms are different ways of looking at the...
4
by: anonymous | last post by:
Thanks your reply. The article I read is from www.hakin9.org/en/attachments/stackoverflow_en.pdf. And you're right. I don't know it very clearly. And that's why I want to understand it; for it's...
8
by: Leszek | last post by:
Hi. I have two forms each in different file user need to fill both one after another. Is it possible to display variables from both forms at the end? does $_POST contains variables from...
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
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?
1
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...
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
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...
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,...

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.