Access: Choose Function

In Access, the Choose function selects and returns a value from a list of arguments based on a given position.

The syntax for the Choose function is:

Choose(index, choice-1[,choice-2, … [, choice-n]] )

You can use Choose to look up a value in a list of possibilities. If index is 1, Choose returns the first choice in the list; if index is 2, it returns the second choice, and so on. The Choose function returns a Null if index is less than 1 or greater than the number of choices listed.

index is position number in the list of values to return.

choice is variant expression containing one of the possible choices.


Choose(1, "Have", "a", "nice", "day")            returns "Have" 
Choose(3, "Have", "a", "nice", "day")            returns "nice"
Choose(4, "Have", "a", "nice", "day")            returns "day"
Choose(7, "Have", "a", "nice", "day")            returns NULL
Choose(2.87, "Have", "a", "nice", "day")         returns "a"

VBA Code

Dim MyChoice As String
MyChoice = Choose(2, "Apple", "Orange", "Strawberry")

This example uses the Choose function to display a fruits name in response to an index. Now the MyChoice variable would contain the value “Orange”.

SQL query

You can also use the Choose function in a query.

SELECT Choose([OwnerID],'Table','Desc','Chair','Mirrow') AS Expr1
FROM Orders


Leave a Reply

Your email address will not be published.