Using the CHOOSE Function
In this tutorial you will learn how to use the CHOOSE Function.
The CHOOSE function returns a value from a list of choices.
=CHOOSE( Index As Single, ParamArray Choice() As Variant )
Index is an Integer
Choice is an array of values
In this example we will use a list of Shipping methods against a list of Customers choice.
If we have a list of numbers: 1, 2 or 3 then we can use the Choose Function to show the relevant Shipping Method.
The result is USPS.
The results using a Query would be
SELECT [Shipping], CHOOSE(1, "USPS", "UPS", "FedEx") AS [ShipHow] FROM CustomerT;
In a Form you could set the Default Value of a Textbox to
=CHOOSE(1, "USPS", "UPS", "FedEx")
In a Form add a TEXTBOX control and rename it "txtCHOOSE", then you could add the following in the Load Event.
Private Sub Form_Load()
txtchoose = CHOOSE(1, "USPS", "UPS", "FedEx")
Access Expert 25
You can find more about this by searching the website.
By: Alex Hedley
Click here to sign up for more FREE tips