totn Access Functions

MS Access: CByte Function

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

Description

The Microsoft Access CByte function converts a value to a byte (ie: number between 0 and 255).

Syntax

The syntax for the CByte function in MS Access is:

CByte( expression )

Parameters or Arguments

expression
The value to convert to a byte.

Returns

The CByte function returns a byte value.

Applies To

The CByte 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 in VBA Code

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

For example:

Dim LCompare as Byte

LCompare = CByte(12)

In this example, the variable LCompare would now contain the byte value 12.