totn Access Functions

MS Access: Cos Function

This MSAccess tutorial explains how to use the Access Cos function with syntax and examples.

Description

The Microsoft Access Cos function returns the cosine of an angle.

Syntax

The syntax for the Cos function in MS Access is:

Cos ( number )

Parameters or Arguments

number
A numeric expression.

Returns

The Cos function returns a numeric value.

Applies To

The Cos function can be used in the following versions of Microsoft Access:

  • Access 2019, Access 2016, Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000

Example

Let's look at how to use the Cos function in MS Access:

Cos (2)
Result: -0.416146836547142

Cos (2.51)
Result: -0.807088180396146

Cos (-3.25)
Result: -0.994129676080546

Example in VBA Code

The Cos function can be used in VBA code in Microsoft Access.

For example:

Dim LNumber As Double

LNumber = Cos (210)

In this example, the variable called LNumber would now contain the value of -0.883877473182372.

Example in SQL/Queries

You can also use the Cos function in a query in Microsoft Access.

For example:

Microsoft Access

In this query, we have used the Cos function as follows:

Expr1: Cos([Quantity])

This query will return the cosine of the Quantity field and display the results in a column called Expr1. You can replace Expr1 with a column name that is more meaningful.

For example:

CosValue: Cos([Quantity])

The results would now be displayed in a column called CosValue.