The coding below works fine. It presents a form with a list box of counties. Allows the user to select ALL, one or several counties and returns a query containing the clients from those counties.
The fields showing in the query are First, Last, Add1, FLAGToMap, City, Prov and Sector_Name.
I want to add in there a choice to select only the records that have are TRUE (-1) in the FLAGToMap field - just like the ALL button, this would be an ALL Selected Button let's say.
I would not know where to begin as I copied and adapted the coding below from a sample database and don't understand - at all - how the query is generated. The only coding in the form is the one below.
Private Sub cmdOpenQuery_Click()
On Error GoTo Err_cmdOpenQuery_Click
Dim MyDB As DAO.Database
Dim qdef As DAO.QueryDef
Dim i As Integer
Dim strSQL As String
I have a multi slect list box (simple) and I need to find and select an item using vba - e.g., the bound column is the ID field and I need to select a specific ID (which will be different each time) as opposed to selecting the 100th record for example. How do I do this?
I have a listbox with *Like* search function as attached file. However, when the cursor moves to the items in listbox, a specific item can not be selected by Key Press even (Enter key). I do not know what my mistake is .
I have several list boxes, and each is populated using a query source. I want to make it so that when you double click a given entry it pops up either a form or query that says more information on the item.
Each list box is populated using two fields from the query a name and a number.
Example
Item A | Value A Item B | Value B Item C | Value C
I want it so if you were to double click Item A a form opens with the rest of the information so a text box or whatever with the following
Item A Value A AnotherValue A Etc A ....
Basically I want to be able to pop up a single line of the query based on double clicking of the list box entry.
This is what I have so far in code:
Code: Private Sub prospectLW_DblClick(Blah As Integer) Dim varItem As VariantDim strPlayer As String strPlayer = Me.prospectLW.ItemsSelected.Item(varItem) MsgBox strPlayer DoCmd.OpenForm ("Popup1") End Sub
The trouble I am having is getting the value from the listbox if I can get say Item A when you double click it ignoring the other info I want just the name of "Item A" so that when I open the form I can use that variable to filter the form I made that is basically just the query within a form. I hope that is enough information if not let me know I can add more.
it has a listbox, wich RowSource is a query with 5 fields, BoundColumn is field#1.I have a comboBox with values of field#1 to have an 'AfterUpdate' Event, that highlights the row in the listBox that has the value of the comboBox in in field#1.
Need Help: Table has several fields, two that pertain to this question are:
[Time] and [AM/PM] User inputs both, values such as 11:00 am 11:30 am 12:10 pm I have to change the pm to am if the time is between 12:00 and 12:59. I have an update query that works but I want to place code in a report that does the same thing without using DoCmd.Open Query I would rather use an If statement. Please help. I placed this question in Microsoft and reply did not answer the question. Rather told me ampm would automatically show up. I knew that, but want to change the automatic pm for sorting purposes.
A while ago I started to use the following code to list the printers installed on a computer. This is code by Wayne Phillips.
This works well, but what if instead of simply getting a big message box with all the printers listed I wanted to be able to click on a name and set that printer? How do I do that?
Code for the button:
Private Sub cmdListPrinters_Click() Dim strCount As String Dim strMsg As String Dim prtLoop As Printer On Error GoTo ShowPrinters_Err
I have an access project that I am working on and need to be able to select multiple items from a listbox and have the exact selections appear in a textbox on the same form. I have looked around and have not been able to find any code that works.
The columns are PayPeriod, StartDate, EndDate, FiscalYear
What I want to be able to do is highlight a chunk of dates and have the first selected StartDate and the last selected EndDate populate two hidden text boxes so I can use them for my queries/reports.
I've tried a couple different ways. Each time what happens is it only uses the last item I have selected in it's calculations.
Code: Dim ItemIndex As Variant For Each ItemIndex In Me.lstPayPeriods.ItemsSelected If Me.lstPayPeriods.Selected(ItemIndex) And Me.lstPayPeriods.Selected(ItemIndex - 1) = False Then Date1.SetFocus Date1.Text = Me.lstPayPeriods.Column(2, Me.lstPayPeriods.ListIndex) End If Next
In this example I tried to have it go through each Item of the listbox. I wanted to check to see if the current row was selected and the row before it wasn't. That way I could determine it was the first item selected in the group of selected items. It would always only use the last item I had selected.
Code: Dim CurrentRow As Integer Dim FirstDate As Date For CurrentRow = 0 To Me.lstPayPeriods.ListCount - 1 If Me.lstPayPeriods.Selected(CurrentRow) Then Date2.SetFocus
[Code] ....
I tried to do something similar with this code. Again, it only uses the last item I have selected.
I have a combo box which gets its values from sql server using a query which is called "get_query_reason", which works fine. Now I want to update combo box values based on a user selection, st string. Have written the code, but does not work:
Dim qDef As QueryDef Dim Query As String Dim st As String Dim rs As Recordset st = "SOV" Set qDef = CurrentDb.QueryDefs("get_query_reason")
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.
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!
Allen Browne's "Use a multi-select list box to filter a report" solution, in particularly with two multi-select list boxes? The code works fine for me for either box so long as I code it for one box alone. Combining the two into one code results in a type mismatch error. I'm trying to use the code to pass the contents of both multi-select boxes as Where conditions to a report. Both boxes are based on number fields. To try to isolate the problem, I've removed Allen's setDescription and OpenArgs conditions. We're unfortunately still on Access 2003 as the company desires to squeeze every dime by using until end-of-life next year.
Code: Private Sub cmdPreview_Click() On Error GoTo Err_Handler 'Purpose: Open the report filtered to the items selected in the list box. Dim varItem As Variant 'Selected items
I created a form and created on it a list box which is a query that grabs certain number of fields from different tables. I would like the user to select from this list box of a choice and then store their selection into a table.This list box has three fields, but it needs to store the id rather than the item, the user would see the name of the item but the id of the item would be store into another table, called bid. It store all these three fields when a user selection one of the item from the list.
tblTimeEntry records individual time slips for attorneys keeping track of their time. Each slip records the client, attorney, time, rate, and value (time * rate) of the slip.tblPeople holds all the timekeepers and their current rate. Their rates change once a year.tblCustomRate will hold the exceptions,
How I imagine tblCustomRate will be set up is as follows (and this may be how it's wrong):Columns for each timekeeper. Each record is a client entry. When a new time entry gets entered, as it gets saved into tblTimeEntry, it should check to see if the client number is one that has a record on tblCustomRate. If it does, it should find the column for the timekeeper and use that rate. could add columns to the tblPeople for each client that gets a custom rate and use IF statements to get it to add, but that's a lot of legwork and code for a few clients.
tblTimeEntry TimeID (primary key) ClientID TKFN (Timekeeper First Name) Rate Value
If it matters, this is Access front end with SQL Express tables. It's few and far between that I set up new People and it would be few and far between that there would be any custom rates (currently, there would be 2 out of 2000). People's rates change, but the time slips they entered at their old rate should stay at their old rate. If they were only worth $100/hour in 2010, but now they're worth $200/hour, the 2010 slips stay at the $100/hour rate.
When I run the below code I am getting the error "End Select without Select Case" I figured it might be because I have the "End Select" before the "End With" however when I move the "End Select" after the "End With" I get the error "Loop Without Do".
Code: Private Sub cmd_Update_Conditional_Codes_Click() Dim rs As DAO.Recordset Dim rs2 As DAO.Recordset
Hi, I have a list box on a form that has peoples names in it. What I would like to do is double click a name then open another form that shows that name in a textbox. I know it can be done, but I'm unsure of the code for it. Thank you!
Hi, I have an access base with the tables (data) and an access base with forms modules etc (program) located on the server, tables are linked. i have 3 or 4 users for this application. Here is my problem: When a user 'A' creates a new record if user 'B' click on the modifiable list the record appears in the list but when he tries to select it, that is the 1st record of the table wich is displayed in the form ?!!, if user 'B' close and re-run the application theres is no problem. What's wrong ? I have next & previous records in my form and there is the same problem user 'B' can't reach the record added by user 'A' I used .requery on each list boxes so my lists are well updated but i can't solve this selection problem (my form is based on the table) Thanks in advance for help.
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.
Good Afternoon! I am working on a database that tracks our members' attendance at a large meeting. Every person at the meeting has at least one role to play at the meeting and may have up to four. I have created a "tablePositions" with the fields "PositionID" and "Position" to define the various roles people can play at the meeting. In my "formRegistration" form I created a list box with the multiselect property set to Simple. The list is working fine, it appears in my form, it displays the names of the positions (as opposed to the PositionID), and I can select more than one "Position". However, when I view the "tableRegistration" table, I do not see any of the "Positions" I clicked on. I would like them to display (for example) "Delegate, Committee Chair, Trustee" in the "Position" field.
I have been digging around the forum to see if any other threads matched my problem, but couldn't find exactly the same issue. I know enough about access to be dangerous, but could you please include the code and where to put the code in your reply?
Thank you. I really appreciate websites like yours! Shelly
I have a check box that when selected will highlight another Text box which I then need to put in an amount ($). This amount I want copied into yet another Text box which contains other information I have provided. I have tried to use the IIf function but I am obviously not succeeding. In the Text box I have the formula as follows: IIf([Combo23]=True, "[Text23]") All this formula results in is '[Text23] because that's what is in the inverted commas. How can I get the actual $ amount to go into the text box. Thankyou so much for your help.
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!
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
I would like to be able to create a recipe (saved in its own table) by pulling items from a multiselect list box (from the raw materials table) but which allows me to add the same ingredient more than once.
I work for a chemical manufacturing company and we need to track the cost of goods by recipe (final product), by linking the ingredients (where the cost of the raws are associated) to the final prodcut. Several of our products need to have chemicals added in the beginning, but then again at the end of the procedure unlike normal kitchen recipes.
(I sure hope I don't have to learn VBA . . . I'm totally new at Access!)
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?