Bob
Bob

Reputation: 1396

Access: Getting Value From List Box

I'm trying to get a value from a ListBox, List80. I'm trying to grab the options chosen, say Red, Blue, Yellow, and have it inserted into a table using a query. I have written the following query:

INSERT INTO Test_User_Activity
VALUES (5554, 4, "Something", Forms![Activities]![List80]);

It runs, but doesn't return any items that were selected in the List. I did something similar to this with a multi-select dropdown list and am wondering where i'm going wrong.

Upvotes: 0

Views: 5246

Answers (1)

xfh2002
xfh2002

Reputation: 56

To access a value of a combo box or list box please use SelectedValue in VBA, i.e. Forms("Activities").Controls("List80").SelectedValue or you can access the value by first determining the SelectedIndex and then pick the value. Then you can use this value in a query.

Upvotes: 1

Related Questions