Multiple Items Selected From List Box Through A From Not Passes To The Table
Nov 23, 2006
Can some one tell me why, on the attached database example, I can select multiple items from list boxes
"TipoCliente" and "FaixaEt" through "frmClientes" form but they are not passed forward to table "tblClientes" ?
Try to onpen attached database example and use form "fmrClientes" and select multiple items at
"TipoCliente" and "FaixaEt" list boxes by entering them with mouse click and Ctrl key pressed .
Select also single item from
"NivEns" Combobox and write anything on "Nome" and "Apelido" fields .
Go to the table "tblClientes" and you can see text fields "Nome" and "Apelido" and also the item "NivEns" from Combobox "NivEns" are all there but not the items you selected from "TipoCliente" and "FaixaEt" list boxes .
I am trying to create a list box that passes to the database a value that is different from what shown in the drop down list. For instance, I want to show the users a drop down list with "Yes" and "No", but then storing into the database "1" when "Yes" is selected and "2" when "No" is selected.
I want to use an array to store data from a list box into a variable. I want it to be able to store one value, or multiple values, depending on what is selected.
Main problem: this list box feeds off a table which has employee names and their e-mails. The list box itself only shows the names, and when I select what I want the array to store is their e-mails, not their names.
Code: Dim strNames As String Dim varItem As Variant Dim intCount As Integer For Each varItem In Me.lstNames.ItemsSelected intCount = intCount + 1 Select Case Len(strNames)
[Code] ....
That code successfully displays the item I selected, but only displays the name. I need to make it look in the table and get me column #2. I also want it to be able to select more than one item at a time.
I have the code below and am trying to have a form allow Text Box to become visible based on selected items from a List box. Why I am getting the error listed?
Compile Error: Invalid Qualifier
Code: Private Sub specific_opt_Click() Dim users As Control Dim ctrler As String Dim xx As Long If Me.specific_opt = True Then GoTo 169
I would like to be able to select multiple items from a dropdown list like we often see on web forms. The kind where you hold down the control key to select up to 5 items. Is this possible on an access form? If so, how would do we implement, and how is such data be stored?
How would I create a relationship between a subform and a coverage field such that when i multi select items in the subform, it will show what items are selected in the coverage field as in the example.
Inside you can find one form with listbox (with multi selecting ability).
I use this code :
Dim strSQL As String Dim i As Variant With Me.se1 For Each i In .ItemsSelected SQL = "DELETE '*' FROM [t1] WHERE [id] = " & .ItemData(i) & " ;" CurrentDb.Execute (SQL) Next End With Me.se1.Requery
Result is this one : 1) If I delete only one item in list, it is ok. I can do it again and again and it is working fine.
BUT
2) If I delete more items in list at once, it is ok - but if I will try to do it again then there is an error because .ItemData(i) value is Null.
I'm trying to create a right-click event on a listbox that will copy selected listbox item(s) to a temp table. So far, I've got this code to acknowledge the right click:
Code: Private Sub List0_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = acRightButton Then MsgBox "You pressed the right button." End If End Sub
Problem is the selected item on the list box doesn't move until after the mouse down event so whatever code I would run would involve the wrong record(s).
I'm using Access 2000 and 2003. How to get the the correct record selected on mouse down, or point me to a working example of right-click functionality on a listbox.
I have a list box that allows multiple selections [Inventory]. I also have a combo box that has multiple selections [Shows].
Right now, user selects from list box and from a combo box and clicks a button. On button click, the items from the list box are associated with the PK from the combo and stored in a junction table. This allows me to quickly associate many inventory items to one show.
I realized that there I currently have no way to prevent duplicate Inventory+show records in the junction table besides having a composite key. This would be fine except no records get inserted into the junction table if there's a duplicate entry.
Ideally, I think that the user should select from the combo box [Shows]. This should narrow down what shows up in the list box [Inventory] in a way that Inventory items already associated with the show are not displayed.
If I have 10 Inventory items and Inventory items 1-5 are already associated with Show 1; after I select the combo box, the list box only displays Inventory items 6-10.
Here's the associated code
Option Compare Database Option Explicit Private Sub cmdAddRecords_Click() Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset Dim ctl As Control
Im trying to delete values from a table based on the selected values of a listbox. The listbox values have a hidden column which related to the ID on the table to which I am trying to delete from (if that makes sense).
If I use the following code:
Code: Set ctl = Me.Results_listbox For Each varItem In ctl.ItemSelected CurrentDb.Execute "Delete * FROM Table1 WHERE Table1.ID = " & ctl.ItemData(varItem) Next varItem
I get an error stating Object doesn't support this property or method.
I have database with an userform called AssignWP, combobox called WPDevBy, listbox called List352 (Multi select) and table called Justified.I am trying to update one field WPDevelopedBy of the table as combobox value based on list box multi selected records.
I have what should be a really simple database to build. In table tbl1PlanHdr is the header item. Many items in tbl2MaintItem will then be allocated to each header. MaintItems items will be allocated to more than one Header.
I want to set up a form that has the tbl1PlanHdr as the main part of the form and tbl2MaintItem as the subform. Possibly as a datasheet, or continuous form.
I need the ability to update items in the subform back to the orginal table.
I have a relationship of one to many from the tbl1PlanHdr to tbl2MaintItem using the primary key in tbl1PlanHdr.
But should this be a one to many from tbl2MaintItem to tbl1PlanHdr
The end result required is to be able to get a data dump of all the tbl1PlanHdr items with the corresponding tbl2MaintItems items.
As my title states, that is my problem! I'm building search criteria from a form and have multiple list boxes... I want to be able to determine whether or not a list box has items selected or not. I have tried as many things as i knew how to with no luck...
Also, i searched the forum but could not find what i was looking for -_-
I have been trying to modify a sample database to suit what I want to do but I am getting stuck on the very first part cascading combo boxes i want to open a form and add multiple items to a table - first i want to select, from a combo box a department - then select a supplier from all the suppliers/manufacturers related to that department then select a stock item based on the description from all the items available from that supplier
I have attached the database I am using to modify and my database.
Hi all, greate site and i have been able to solve most problems by using the search box although this problem is doing my head in...!!
I have a db that records project numbers and their details. I am using a listbox to allow a user to multiselect Project Involvements Tasks(ie Documentation, Build etc) against a project number.
I am able to read the selections into a separtate table with two columns which is structured as:
as you can see I dont have a problem getting the Itemsselected into a table... the problem that i am having is getting them out again when the record is displayed - ie marking them as itemsselected.
I believe that the event would be onCurrent which would loop through this table pick up the project number and recorded invovements and mark them as selected in the listbox. if there is no invovement then the listbox would show no selections.
I am using this code to read the selections in
=========================== 'Records project involvements against project Public Function AddInvolvements(ctlRef As ListBox) As String On Error GoTo Err_AddInvolvements_Click
Dim i As Variant Dim dbs As DAO.Database Dim rs As DAO.Recordset Dim qd As DAO.QueryDef Dim strDelete As String
Set dbs = CurrentDb Set qd = dbs.QueryDefs!qInvolvement Set rs = qd.OpenRecordset
'Delete records where project number exists against an invovelment incase of involvement changes strDelete = "Delete Project_Involvement.ProjectNo " & _ "FROM Project_Involvement " & _ "WHERE (((Project_Involvement.ProjectNo)=[Forms]![Add_Project_Details]![ProjectNo]));"
For Each i In ctlRef.ItemsSelected rs.AddNew rs!InvolvementType = ctlRef.ItemData(i) rs!ProjectNo = Me.ProjectNo.Value rs.Update Next i Set rs = Nothing Set qd = Nothing
Exit_AddInvolvements_Click: Exit Function
Err_AddInvolvements_Click: Select Case Err.Number Case 3022 'ignore duplicate keys Resume Next Case Else MsgBox Err.Number & "-" & Err.Description Resume Exit_AddInvolvements_Click End Select
End Function ===================================
Any help would be much appreciated - also thanks to Pat Hartman for his excellent examples esp http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=54924
I have 2 Listboxes the first list is based on a query I need to select items from this box or part of each item and move to another listbox. the items in the second listbox will be used in a report. I have previously posted on another forum with no real luck fyi. the query is put straight in the RowSource.
I'm creating an employee audit database, and, in the audit form, the user (ie. supervisor) can select a number of items from a listbox. Each item selected corresponds to an error that the employee has made, and, as such, the employee's Audit Score has two points deducted for each item that is selected.
Incidentally, there are other, solitary elements to the form, but this particular listbox houses a collection of items that are related under a single category.
The score is displayed at the bottom of the form, and it needs to update in real-time.
The problems that I am encountering are that I am unable to count the number of items selected and then I am unable to multiply that count by 2 (the point-value of each item on the list.)
I have a DB where you there's 5 tables all linked together by one project ID
tables below
Project , Staff, Asset, allowances, travel, mark up
What I can do is create a new project, then add records to each of the other tables on what different items I require,
i.e. I create a new project - called project one, in the project table I create a record stating, name, time scale, client and location, then I add different records to each of the other tables on what I require all linked to the same project ID. (probably not explained that too well)
Now I want to create a query that lists all the requirements one after the other this will make it easier to create reports and to calculate costing's.
At the moment I have made 5 different queries listing all the data, then have one report containing 5 sub reports to display the data, no this does work.
This is a somewhat complicated question to explain, so please bare with me.
I have a form with a ‘list box.’ The box is populated using a Table/Query Row Source Type method. The table I am grabbing the list from is “Department,” where it contains a list of my company’s departments(ie. Accounting, HR, Payroll, etc.).
Now, the only thing this table does not have is the word “ALL.” I need this word in the “List Box” because I want users to have the option to select ALL.
Is there anything in VBScript code wise or in Row Source that I can do to include this word?
I know I can manually go into the Department table to simply add the word, but this is not the point, because there is more to that(I have different list boxes that are grabbing lists from different tables, AND I have to refresh these tables twice a week). Please help.
Hi just started working for a Company and I found they have tons of databases but no structure or standard, so I would like to build a tool that will go thrue a list of databases and get all the table names, the items and type. Is there functions in vba that can get me a list of the tables in the database and the get all the items in the database ?
I have a form where there are 2 list boxes: Part_List and acbPartList. acbPartList has multiselect enabled and what I want to do is be able to select multipler records in that list box and then press a button to add those selected records into the other list box. Here is my code for my button:
Private Sub addItemButton_Click() Dim varItem As Variant With Me.acbPartList_Existing For Each varItem In .ItemsSelected Me.Part_List.AddItem (varItem) Next End With Me.Part_List.Requery Me.Refresh End Sub
I'm not sure if passing varItem is correct, but regardless, it isn't working because Part_List is based off of a query, its not a value list.