# Web Development

## General discussion

Locked

### Access query

By ·
I am moving some stuff from excel to access. I am having a problem with one equation that I am trying to make a query. I have the following equation in Excel: =DEGREES(ATAN(B12/B11))
How would I write this formula in an access query.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

Collapse -

### Access query

by In reply to Access query

This isn't very pretty. In the query have a calculated column, thus:
trigbit: trigthing([SSN]/[sex])

In a Visual Basic module have a constant and function, thus:

Public Const pi = 3.14159265358979

Public Function TrigThing(number As Long) As Long
TrigThing = 180 / pi * (Atn(number))
End Function

Double or Decimal may be better than long, but basically this works.

Collapse -

### Access query

by In reply to Access query

Collapse -

### Access query

by In reply to Access query

What is against using in your query grid the following field?
Result: Atn([b11]/[b12])*180/3,14159265358979
This assuming that the other fields in the table are b11 and b12.
NOTE It may be needed tot use . [dot] and not , [comma] in PI.
Good luck

Collapse -

### Access query

by In reply to Access query

Collapse -

### Access query

by In reply to Access query

Point value changed by question poster.

Collapse -

### Access query

by In reply to Access query

an easier way of writing pi is instead of 3.14..... use: pi=atn(1)*4

visual basic is a good way of solving this.

visual basic trig functions must have the angles in radians, so to convert b12 and b11 to radians if they are not in radians is to times the angle in degrees by (pi/180). rad=angle*pi/180

create variables b11 and b12 as doubles:
dim b11 as double, b12 as double

atan is inverse tan. so do
atn(b12/b11)

then you must convert this to degrees
atn(b12/b11)*180/pi

so hav a variable to hold this value

however as you are using this in a query it would just be:

(atn(b12/b11))*180/pi

!where b12 and b11 must be field names!

that should work

Collapse -

### Access query

by In reply to Access query

sorry, i forgot in access pi is not listed as a constant so u must use an integer 3.1415926535897932 etc. depending on the degree of accuracy you want. so it will now be:
--------------------------------
-- (atn(b12/b11))*180/3.14159 --
--------------------------------

(where b12 and b11 are field names)

Collapse -

### Access query

by In reply to Access query

Collapse -

### Access query

by In reply to Access query

This question was closed by the author

## Related Discussions

• 21

• 10

• 2

#### What are the top 5 programming languages for web development?

escalesolutions2 ·

• 1

#### Help with hosting a web server

Harry_TheKing1 ·

• 2

#### Office 365 DNS Records

alexis1606845310 ·