Microsoft Access Multi Value - ms-access

I have a Multi value table with ItemCatergory, Item Description, Unit and Rate, Linked to a table with the full list of records.
I wish that when the multi values (Item catergory) are selected then they will auto display in the next fields.
i have previously done this with combo boxes, but not with multi value, i now get a error in the code, which in theory should load the values into the text boxes.

Related

In MS Access combo box,how to use form value as where class

I am using following query in combo box for display data from table based on form text box field as parameter but combo box is not displaying data. Please note that itemid field in main item table is string.
SELECT [Item].[ID], [Item].[ItemCode], [Item].[ItemName], [Item].[Price_USD],
[Item].[Price_GBP], [Item].[Price_THB], [Item].[Price_AED], [Item].[Price_AED_VAT],
[Item].[Price_SAR], [Item].[Price_SAR_WHT], [Item].[Hogan_Cost_USD]
FROM Item WHERE [ItemCode]='Forms!Order_Detail subform!itemid';
If this is a query object, then must reference subform through parent form and subform container control. I always name container different from the object it holds, such as ctrDetails
WHERE [ItemCode]=Forms!parentformname!ctrDetails.Form!itemid;
If this SQL statement is directly in combobox RowSource and combobox is on subform along with the textbox, just reference textbox directly. I always name controls different from fields, such as tbxIC:
WHERE [ItemCode]=[tbxIC]
Are you pulling in every field from Item table? If so, could shorten the SQL with wildcard:
SELECT * FROM Item WHERE [ItemCode]=[tbxIC];

MS Access 07-10, want to be able to put fields into a list / combo box

Just wanted to know how you can put column headings (fields) in MS access into a list box or drop down to make a multi-search form for 'n' number of fields.
colour | texture | <- fields
red.......smooth
blue ....rough
I wanna have drop down where i can put colour and texture in a list box and select them and then search against them
It's very simple now in Access 2007 and later. (I don't remember how to do it in XP and earlier.)
Create your combobox on a form, set the Row Source to your table and select "Field List" as the Row Source Type. That's all. The table field names will show in your combo box.

How to reference a comboboxes to input values into a query?

How to a get the value of value selected in a combo-box? I have a combo-box called "cndGetUsage" in a form called "frmStationUsage". How do I get the value in the form and check to see if a value was selected?
This are being referenced from a module called mMainOutputs.
myval = Me.cndGetUsage.Column(1)
or
myval = [Forms]![frmStationUsage]![cndGetUsage].Column(1)
these will tell you what the current value in the box is. the columns are because in access your combo box can have multiple columns. also if you set the bound column then you don't have to specify it.
Where are you populating the list from? It works great if you're using a Select statement, from a table with a unique ID field as a unique key. Your combo box index is zero based. If you have more controls in the form you can use the Recordset Clone and Bookmark statements to move back and forth as you select items from the combo box

List Box multiple value selection

I have created form based on query output. I had used three comboboxes and one list box. First combobox gives me list of Dept, selection of Dept on second gives me location of that Dept (distinct), the third gives me (distinct) project from that location, then next is list box who displays the some codes of that project. The problem is I am able to select only one code from that list and get output in Excel.
If I wanted to select two values at a time, how would I do that?
If I select Multi Select from list box property than I am able to select multiple values but I am not getting output.
When a List Box has its Multi Select property set to "None" then you can retrieve the selected value by simply referring to
Me.List0.Value
However, for multi-select List Box controls you need to iterate through the ItemsSelected collection to determine the items that are selected:
Dim ItemIndex As Variant
For Each ItemIndex In Me.List0.ItemsSelected
MsgBox Me.List0.ItemData(ItemIndex)
Next

MS Access Dropdown List/Combo Box

This should probably be pretty simple but my Google-Fu is as yet unable to find an answer. I simply want to create a dropdown list in Access so that upon selection I can perform some action based on the value of the selection. For instance, I have a list of people and I would like to populate the combo box so that their names appear in the list but the "value" is set to their ID (the primary key).
It sounds like you might be asking how to display something in the dropdown other than the ID while keeping the ID as the returned data from the dropdown. If that's the case set the Bound Column to the ID field (usually 1) and (assuming the name field is next) set the Column Count to be 2 and the Column Widths to be 0";1" or 0";[whatever width you need].
You will need to hook into the onchange event for the dropdown list.
and from MSDN
How have you set the properties for your combo box?
Perhaps you could try setting (assuming you are pulling data from Table1 with fields ID and Field1
Row Source: SELECT [Table1].[ID], [Table1].[Field1] FROM Table1;
Row Source Type: Table/Query
Bound Column: 1
Column Count: 2
Column Widths: 0", 1"
and then hook into the onchange event as Chris Ballance suggests. The value property of the combo box is ID; the text will be what is in Field1.
OK, I figured it out even though it was a bit counter-intuitive. An Access Combobox can have as many values as you want (instead of just one key on value). By default all of the values are are shown in the list so you need to hide certain columns by setting their widths to 0. That is done via the ColumnsWidths property in the property pane. ColumnWidths takes a comma separated list of values which corresponds to the order of the columns in the list. I hope this helps someone.