By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,863 Members | 879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,863 IT Pros & Developers. It's quick & easy.

Math function help

geo17
P: 1
I am new to using Access 2007 and I am creating a database for work. On one form I have text boxes for GPS coordinates. One set is a known point in x and y and the other set is a measured x and y (UTM coordinates). I want to display the offset of these two different measurements. Simple equation. I just don't know what is the best way to do this in Access. Should it be done on the form in a text box (and then stored in the table) or should a query be used. How is this set up?

Equation is d=[(x2-x1)^2+(y2-y1)^2]^1/2 or
d=sqrt[(x2-x1)^2+(y2-y1)^2]

x1=txtControlNorthing
y1=txtControlEasting
x2=txtMeasuredNorthing
y2=txtMeasuredEasting
Thanks
Dec 21 '07 #1
Share this Question
Share on Google+
2 Replies


patjones
Expert 100+
P: 931
I am new to using Access 2007 and I am creating a database for work. On one form I have text boxes for GPS coordinates. One set is a known point in x and y and the other set is a measured x and y (UTM coordinates). I want to display the offset of these two different measurements. Simple equation. I just don't know what is the best way to do this in Access. Should it be done on the form in a text box (and then stored in the table) or should a query be used. How is this set up?

Equation is d=[(x2-x1)^2+(y2-y1)^2]^1/2 or
d=sqrt[(x2-x1)^2+(y2-y1)^2]

x1=txtControlNorthing
y1=txtControlEasting
x2=txtMeasuredNorthing
y2=txtMeasuredEasting
Thanks
Do the coordinates already exist in a table, or are you looking to have the user populate a table by typing the coordinates into a form and calculating the offset after all four numbers have been entered?

Best,

Pat
Dec 21 '07 #2

ADezii
Expert 5K+
P: 8,623
I am new to using Access 2007 and I am creating a database for work. On one form I have text boxes for GPS coordinates. One set is a known point in x and y and the other set is a measured x and y (UTM coordinates). I want to display the offset of these two different measurements. Simple equation. I just don't know what is the best way to do this in Access. Should it be done on the form in a text box (and then stored in the table) or should a query be used. How is this set up?

Equation is d=[(x2-x1)^2+(y2-y1)^2]^1/2 or
d=sqrt[(x2-x1)^2+(y2-y1)^2]

x1=txtControlNorthing
y1=txtControlEasting
x2=txtMeasuredNorthing
y2=txtMeasuredEasting
Thanks
  1. Create a Query on the Table(s) that is/are the Record Source for the Form.
  2. In this Query, create a Calculated Field called Offset:
    1. Offset: Sqr(([x2]-[x1])^2)+(([y2]-[y1])^2)
  3. Now, set the Record Source of your Form to this Query.
  4. Create a Text Box on this Form, and set its Control Source = Offset. It will now display the Offsets for various combinations of X1, X2, Y1, and Y2 for each Record.
  5. I'm making the assumption that [X1], [X2], [Y1], and [Y2] are Required Fields. If any data is missing in either one of these Fields, you will get an Error in the Offset Text Box.
  6. If you need the capability to have the User Add/Edit values in the [X1], [X2], [Y1], and [Y2] Fields and have the Offsets dynamically generated in the Offset Field, then stored in the underlying Table, you will need an entirely different approach.
  7. Let me know exactly what you are looking for.
Dec 22 '07 #3

Post your reply

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