Multi Select List Box Formatting
I am using a Multi Select List Box to display a list of names from a table, in order to select e-mail recipients. The names are in two fields: [Main]![First Name] and [Main]![Surname].
I have done this by using the following code for the rowsource:
SELECT DISTINCTROW Main![e-mail], Main![First Name], Main!Surname FROM Main;
This gives a rather undesired effect, in that shorter first names have a large gap before the surname. In addition, there is a dull separating line between the two columns, thus:
Jane | Smith
Bartholomew | Simpson
My questions:
Is it possible to arrange the names so they appear in one column, with a space between them? (i.e. they would appear as written)
If not, can I get rid of the separating line?
Many thanks in advance if you can help!
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
List Box One Click Select/deselect With Multi Select
Hi, is there any (reasonably simple) way to select or deselect multiple items from the List Box with individual clicks without using Ctrl key. Eg first click on an item would select it leaving all other items as they are, subsequent click on the already selected item would deselect it etc. I hope this is not too confusing and I would appreciate some help. Thanks!
View Replies !
View Related
Multi-Select List Box
Hi, This is my first posting on this forum, and I would greatly appreciate any help with this issue... I have a form that is used for entering information into tables. I would like to be able to select multiple options from a list on a form and have it saved into a table. Any ideas? Is this even possible :confused: Here are some paths I followed: The table has a List Box field, type Text, that gets values for the list items from another table. On the form, I have changed the Multi-Select property of the List Box to "Extended" so that the user can select multiple items from the list. But when I select items from the List Box, the table is not getting updated with the selected items. Another way I tried doing this: The table has a List Box field that has no values (I'm not looking up values from another table). On the form, I set the Row Source of the List Box equal to the query that gets the list values from a table. I then set the Multi-Select property to "Extended". When I select multiple items from the List Box, the table doesn't get updated. FYI: The control source for the list box on the form is pointing to the field in the table. Thanks, dbnewbie
View Replies !
View Related
Multi-Select List Box
Good morning all... I have two questions regarding a multi-select list box. First, is there any way to have the list box include multi-line items...or which will scroll beyond the right border of the box? Second, I have a multi-select list box which is populated with an ID # column and a Description column. The user can select as many items from the list box as needed and, as the list box item is clicked, the ID # is added to a memo field on the form, with each ID # delineated with a coma. Is it possible to separate the memo field back out so that each item is identified individually (for report purposes)? Thanx so much for your help with this...you guys/gals are simply the best! Karen
View Replies !
View Related
Multi List Select Problem
I have a dialog box where the users can filter a report by various combo boxes that works well. I'm trying to add a multiselect lis box option for one of the combo boxes and have added code which I've also used before. Together the code is looping through and opening the report without a problem, except it's not filtering by the options selected in the list box. Here's what I've got: If Left(Me![cboSupplier].Column(0), 1) = "*" Or Right(Me![cboSupplier].Column(0), 1) = "*" Then where = where & " AND [qssupp] Like " + Me![QSSupp].Column(0) Else where = where & " AND [qssupp]=" + Me![cboSupplier].Column(0) End If If Left(Me![cboPartNo].Column(0), 1) = "*" Or Right(Me![cboPartNo].Column(0), 1) = "*" Then where = where & " AND [partID] Like " + Me![PartID].Column(0) Else where = where & " AND [PartID]=" + Me![cboPartNo].Column(0) End If For Each varItem In cboStatus.ItemsSelected If strCondition = "" Then strCondition = "[odstatusid] = " & cboStatus.Column(0, varItem) Else strCondition = strCondition & " OR [odstatusid] = " & cboStatus.Column(0, varItem) End If Next varItem Set QD = db.CreateQueryDef("Dynamic_Query", _ "Select * from qryWeeklyOrderStatusRpt " & (" where " + Mid(where, 6) & ";")) If (DCount("*", "Dynamic_Query") = 0) Then MsgBox "There are no records to print" Exit Sub End If Can anybody see where I'm going wrong?
View Replies !
View Related
Using Multi Select List Boxes
i have been looking at threads on this subject, and i cannot see the answers to my problem, i have a subform containing a list box (list box1) of values relating to the critical value of the subfrm what i want to do is have the ability to change the records contained in the list box1 currently to do this, i have created a pop up form with a list box (list box2) containing all the potential values of (list box1), on closing the pop up form, there will be append and delete queries to change the records in listbox 1 and other related tables, this i have managed to work out already my problems are 2. how do i highlight the records in listbox 2, that are already contained in listbox 1 on closing the pop up form, how do i update the listbox 1 on the subform with the amended records as ever, i apologise for the lack of techincal terminology and appreciate any help in advance.
View Replies !
View Related
Two Multi Select List Boxes
I have two multi select list boxes that I want to filter a query. I can curently filter the query with selection from one list box. I would also like the query to appear in a subform and the email address that the query out puts to appear in a text box. Here is my curent code: On Error GoTo Err_cmdClerkship_Click Dim MyDB As DAO.Database Dim qdef As DAO.QueryDef Dim i As Integer Dim strSQL As String Dim strWhere As String Dim strIN As String Dim flgSelectAll As Boolean Dim varItem As Variant Set MyDB = CurrentDb() strSQL = "SELECT * FROM tblClerkship" 'Build the IN string by looping through the listbox For i = 0 To lstrole.ListCount - 1 If lstclerkship.Selected(i) Then If lstclerkship.Column(0, i) = "All" Then flgSelectAll = True End If strIN = strIN & "'" & lstclerkship.Column(0, i) & "'," End If Next i 'Create the WHERE string, and strip off the last comma of the IN string strWhere = " WHERE [strClerkship] in (" & Left(strIN, Len(strIN) - 1) & ")" 'If "All" was selected in the listbox, don't add the WHERE condition If Not flgSelectAll Then strSQL = strSQL & strWhere End If MyDB.QueryDefs.Delete "qryMaster" Set qdef = MyDB.CreateQueryDef("qryMaster", strSQL) 'Open the query, built using the IN clause to set the criteria DoCmd.OpenQuery "qryMaster", acViewNormal 'DoCmd.OpenForm "qryMaster", acNormal Thanks
View Replies !
View Related
Using Multi Select List Boxes To Run Queries
I have a simple question that I know will have a very complex answer You have two sets of tables with identical structures. The first set contains data that is a model for the second set. The users run queries that append data to the second set of tables Here is an example of the structure TblSourceOne SourceOneID SourceOneData TblSouceTwo SourceTwoID SourceOneID SourceTwoData TblSouceDetails SourceDetailsID SourceTwoID SourceDetailsData As you can see TblSourceTwo contains a foreign key from TblSorceOne and TblSorceDetails contains one from TblSourceTwo The main table for the second set TblTargetOne TargetOneID SourceOneID TargetOneData The user adds a record to the main table (TblTargetOne) then uses an append query to add all of the applicable records from TblSourceTwo to TbleTargetTwo TblTargetTwo TargetTwoID TargetOneID TargetTwoData So now the user has a data model in TblSourceTwo which has been “copied” to TblTargetTwo Next for each record in TblSourceTwo that has been copied to TblTargetTwo that has daughter records in TblSourceDetails another query is executed to copy all of the pertinate records to the TblTargetDetails TblTargetDetails TargetDetailsID TargetTwoID TargetDetailsData Now the user has completely copied all of the necessary record for both table. Finely the question How can I use a multiselect list box to achieve this in one operation? I don’t care if it includes running multiple queries but it needs to appear as one single operation to the user.
View Replies !
View Related
Query Selected Fields From A Multi-select List Box
I'd like to return - preferrably through a query but a report works as well - selected table fields. I currently have a form that selects certain records from the table based on a couple multi-select list boxes. However, I'd also like to be able to select which fields are queried/reported from the table. I can make a list box containing the field values of my table but I'm not sure where to go from there. Thanks in advance for any help.
View Replies !
View Related
Assign Query Output To Multi Select List Box
Morning - I have been searching a bit but to no avail. I have a query (qryTopTenList) set up in a database that selects the Top Ten "Classes" from a table with a key field of "insclass". I have a multi select list box (LstInsClass) that allows end users to select multiple insurance classes. What I would like to do is set up a standard button that when clicked, will loop through all of the insclass in the query "qryTopTenList" and then select those same insurance classes in my multi select list box. So the end result is that 10 records in the List Box would be selected. This is helpful b/c it prevents the need to go through the entire list box to select the top ten classes. Thx in advance for any insight. I appreciate it. Rob
View Replies !
View Related
Multi-select List Record Creation Code
I have a multi-select list box for selecting which faculty members apply to a project. The faculty table and project table are linked in a many-to-many relationship. I have the following code which should create entries in the link table: Private Sub Command5_Click() Dim varItm As Variant rs.Open "tblFacultyLink", CurrentProject.Connection, adOpenDynamic, adLockOptimistic For Each varItm In lstFaculty.ItemsSelected rs.AddNew rs!FacultyID = Me.lstFaculty rs!EntryID = Me.EntryID rs.Update Next varItm rs.Close Set rs = Nothing End Sub It successfully creates new records and enters the EntryID and LinkID (autonumber). However, FacultyID is always left blank. lstFaculty is the unbound list box which has three columns from the faculty table and is bound to FacultyID. Any ideas on why FacultyID isn't created in the link table (I get no error messages)? Also, any ideas on how to prevent duplicate links being created every time the button is pushed? I was planning on having it first run a delete query for that EntryID in the link table so that it replaces the old links and any that have now been unselected are no longer linked. Comments on that idea? Thanks again to everyone on the forums for your help.
View Replies !
View Related
Multiple Combo Boxes Instead Of Multi-select List For Query ... ?
I have a database to keep track of overtime. Via combo boxes, the form prompts the user for department, date range, and employee and returns the amount of overtime worked by that employee for that department in the given range. I'd like to put 5 combo boxes on the form and allow the user to select up to 5 employees, resulting in a report with each of the employees listed with their respective data. I have considered a multi-select list box, but since we have 300+ employees the ability to start typing a last name to select each employee seems a little more user-friendly. I do have a report that lists all employees in the selected department and date range, but want the ability to select up to 5 employees instead of look through a report/list with 300 names. I am new to Access, would like to know I'm proposing is the most feasible way to accomplish what I need and a general example of how the query would be set up. Thank you in advance for your time. Ceidre
View Replies !
View Related
Select Values In Multi Select Listbox
i have a multiselect listbox in my form. The multiselectlistbox contains the names of different persons from tblUsers. it's allready possible to write the id's of the names to another table (tblPresent). But what I can't manage to do is re-select the values in another multiselect listbox. This multiselectlistbox is located on my editform. I can display the values using a valuelistbox, but i need to see the non-selected items too.. hope someone can help me out
View Replies !
View Related
Multi Select Box's
I am looking to see if anyone can help i have been able to get the multi select function part of my form working but i need another filter in the query for a date but it keeps deleting this part of the query everytime i run the report what i need to be able to do is get all jobs against a specific leadcraft that are in the past and also 31 days into the future. Paul here is the sql so far, thanks to those who helped already. Private Sub preview_Click() Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim varItem As Variant Dim strCriteria As String Dim strSQL As String Set db = CurrentDb() Set qdf = db.QueryDefs("FAelecplan") If Me!Leadcraftlist.ItemsSelected.Count > 0 Then For Each varItem In Me!Leadcraftlist.ItemsSelected strCriteria = strCriteria & "MAXIMO_V_WORKORDERS_FA.LEADCRAFT = " & Chr(34) _ & Me!Leadcraftlist.ItemData(varItem) & Chr(34) & "OR " Next varItem strCriteria = Left(strCriteria, Len(strCriteria) - 3) Else strCriteria = "MAXIMO_V_WORKORDERS_FA.LEADCRAFT Like '*'" End If strSQL = "SELECT * FROM MAXIMO_V_WORKORDERS_FA " & _ "WHERE " & strCriteria & ";" qdf.SQL = strSQL Dim stDocName As String stDocName = "elecplan" DoCmd.OpenReport stDocName, acPreview On Error GoTo Err_preview_Click Exit_preview_Click: Exit Sub Err_preview_Click: MsgBox Err.Description Resume Exit_preview_Click End Sub
View Replies !
View Related
IIf Statement Multi Select
I have multiple codes assigned to records in a table. I want to be able to say IIf [code] = "FMIX",[qty]*2.2046/7.1, IIf [code] = "Liqd", [qty]*2.2046 and everything else can just equal [qty]. I have tried this statment Expr1: IIf([family-code]="FMIX",[SumOfqty-on-hand]*2.2046 IIf([family-code]="LIQD",<[SumOfqty-on-hand]*2.2046>,[SumOfqty-on-hand]),[SumOfqty-on-hand]) and it doesn't work. Can anyone tell me what is wrong?
View Replies !
View Related
Multi-Select Form
I would like to create a form that my users can select multiple check boxes from and have only those records that meet the criteria come up in a search. See attachment for a look at the form. I need to be able to let the user have the ability to put in a name and then select any of the check boxes and then click on a search button that will execute a query that will bring up the results. Any help with code or at least a point in the right direction would be nice. Thanks, Chuck
View Replies !
View Related
Multi-Select Listbox
Using this code to filter records in a query. If I select one selection from the list box it works fine. Returns nothing if I select more than one record. Any help would be appreciated!!!!!! Code:Public Function RecordsSelected() As String Dim memberSelected As Variant Dim strItems As String For Each memberSelected In Forms![frmAllMemberSelector]![lstMembers].ItemsSelected() If Len(strItems) <> 0 Then strItems = strItems & "'" & "," & "'" strItems = strItems & Forms![frmAllMemberSelector]![lstMembers].Column(0, memberSelected) Next memberSelected RecordsSelected = strItemsEnd Function
View Replies !
View Related
Returning Multi Select Values
I have a problem that I haven't seen discussed here yet. (I know this is not good practice, but we're doing this for transfer to another application that wants and accepts data this way) 1) I have a multi select list box. 2) I have code that saves all the values in a semi colon delimeted list in a single field in the DB. (As I said, the application that this data is going to (and from) wants and accepts data in this way) 3) My problem is this. When I re-open my form, how do I get the values that are stored in the database to be highlighted in the multi select list box. I have code similar to this running, but still can't figure it out. Dim lst() As String rst.Open sSQL, cnn, adOpenStatic, adLockOptimistic lst = Split(rst(0), vbCrLf, -1) 'Split the recordset into an array For i = 0 To List96.ListCount For j = 0 To UBound(lst) 'lopp until the upper bound of the array 'If the item in the list box = the item in the array then highlight the item in the list box If List96.ItemData(i) = lst(j) Then List96.ItemsSelected(i) = True End If Next j Next i In a nutshell, that's the problem. My list box contains a list of about 5 or 6 things, the user can select any number of them, and I store it in a single field in the DB semi colon delimited. However, I don't know how to return that field to my list box with the selected values highlighted. IE if the list contains A, B, C, D and the user selected A, C the field in the DB looks like this A;C. When I open the form again, I want to highlight A and C in my list box since those were the fields the user selected. What happens is A;C gets passed to another application (which wants it that way). However, in that other application those values may or may not change, and then they will be passed back to me. (IE the other application may change those values to A;B;D and pass it back to me (which I accept no problem). However, when the user opens the form I want A B and D to be highlighted in the multi select list box Any help is much appreciated Robbo
View Replies !
View Related
Programmatically Multi-select Listbox
hello! i'm trying to select more than one value in a listbox based on a comma-seperated string in a textbox. it seems to be doing what it's supposed to do, except it's only selecting the last value it loops through. it doesn't seem to remember the others. there's probably an easier way to do this than how i did it, but here is the code: Code:Dim lst As ListBoxDim lngCount As LongDim strSelection As StringDim strNewSelection As StringDim intLen As IntegerDim lngLen As LongstrNewSelection = ""strSelection = Me.Text19.ValueWhile InStr(1, strSelection, ",") <> 0strSelection = Trim(strSelection)lngLen = Len(strSelection)intLen = InStr(1, strSelection, ",")strNewSelection = Left(strSelection, intLen - 1)Set lst = Me!List0lst.RowSource = lst.RowSourceFor lngCount = 0 To lst.ListCount - 1 If lst.Column(0, lngCount) = strNewSelection Then lst.Selected(lngCount) = True Exit For End IfNext lngCount strSelection = Right(strSelection, lngLen - intLen)Wend any bright ideas??? thanks, *j
View Replies !
View Related
|