Populate 2nd Listbox
Dec 13, 2005
I have a tblWorkoutLog which contains workout data (body focus, excercise, date, etc.).
I have a listbox (populated from a table) which allows a user to select a/several body focus (arms, legs, etc.). Once the selections are made, a query is created with the IN command to filter based on the selections.
I would like to add a second listbox that will populate with dates that are associated with the selections made in the first list box. For example, if "arms" and "legs" were selected, I want all the dates where "arms" or "legs" were worked on to populate the second listbox. After the user makes those selections, I would like create a final query with the output (i.e. all data associated with "arms" and "legs" on the selected dates).
The first listbox works great, but I don't know how to populate the second listbox and use that selected information.
I am learning code and SQL statements as I go so please be patient with me.
Thank you.
View Replies
ADVERTISEMENT
Aug 19, 2005
I want to pass a search parameter from a form to a query then use the query results to populate a multi-column list box. So far, I can pass the parameter to the query and generate results, however, I want the query results sent to a listbox rather than create a new window.
I set up the listbox to receive results from the query, but when the form opens the listbox is already populated with arbitrary query results. I want the listbox to be empty when the form is opened, I submit a parameter to a query, and the listbox fills with the results
Additionally, once the listbox is populated, I want to clear the listbox but am having the error: The RowSourceType property must be set to 'Value List' to use this method.
View 2 Replies
View Related
Jan 8, 2014
I want to fill my 2-column listbox on a form with the following VBA code:
Option Compare Database
Private Sub Form_Load()
Dim proefsel As Integer
Dim nproducts As Integer
[Code]...
When i run the code i get a compile error on the code in bolt. I am using access 2010.
View 3 Replies
View Related
May 29, 2005
I have a list box that is populated based on a table. now I have three labes that are also added to the form. What I will like to do is....
ListBox (3 colums)
On Double Click (listbox)
Set Label1 to the First Column.text in the list box
Set Label2 to the Second Column.text in the list box
Set Label3 to the Third Column.text in the list box
What i'm looking for is a way to update my labes based on the selection I make in the list box.
kind of like a confirmation.
On Double click it will show on label and it will act as a confirmation.
This customer(record) has been selected!
If there is another way to kind of show this same functionality please tell. I'm kind of new at Access but a master in Excel so I'm not affraid of VBA.
Thank you in advance.
View 2 Replies
View Related
Apr 7, 2014
I have some code that successfully gathers some items and adds these items to a listbox, one item at a time using .AddItem.And it works ok.The problem is, when there are a bunch of items to add, everytime the .AddItem runs, the form redraws.there are a bunch and this leads to a lot of flicking while the form redraws however many times .AddItem adds an item.
I've had the idea of building an array and then assigning the array to the listbox.I can build the arrray no problem but i have not been able to assign the array to the listbox all at once.how to do is add items to the listbox from the array one specific item ListArray(i) at a time.
Obviously this would work, but gains me nothing in terms of the visual effect in the form becuase it is still adding to the listbox one item at a time.Is there some way to assign an array to a list box all at once, without doing it one item at a time?
View 3 Replies
View Related
Sep 19, 2013
In my tables I have a field called first serial. This is the first element of a serial number range associated with each record. Very rarely I have to ask the user to specify a certain serial number in that range. (The serial numbers can be generated easily from the first serial) This happens during the run of a macro, so I have to use a Fom opened with WindowMode:=acDialog. The problem is that I have to populate a listbox with the generated serial numbers on that form. But I can't interact with a dialog form, since it stopos the running of the macro. I have tried to open it hidden, and change the modal property to true once the listbox have been populated, but this dosen't stop the macro to wait for user input.Is it possibble to pass the first serial value to the form, and populate the listbox in one of the Form's opening events?
View 3 Replies
View Related
Jun 12, 2015
I have a list of staff that have a conflict of interest with a particular entity. As a result, these staff are not allowed to interview these entities.
I have a query that matches all staff with their respective entities that they have a conflict of interest with (CoI) and that is functioning correctly.
When the form loads to add an interview, there is a listbox that pulls all the people who are not allowed to do an interview with that particular entity. That is also working correctly.
I have a subform, that is a continuous form, which will allow the user to add staff, one at a time, via a drop down box. These people are stored in their own table with a FK Id to the interview table. This also works correctly.
How to filter the combobox on the subform to exclude the people in the listbox.
Here is what I have tried, loosely based on what I have found on Google and researching here. I am 100% sure it is not working correctly, but what I am missing.
The query the listbox is based on has 3 colums, the ID, the Name, and the business contract number.
Code:
Private Sub Form_Load()
Dim strSource As String
Dim i As Integer
For i = 0 To Me.lstCoI.ListCount - 1
[Code] ....
In the immediate window, I get the following result:
SELECT [staff] FROM lutStaff WHERE Staff <> name1
SELECT [staff] FROM lutStaff WHERE Staff <> name2
SELECT [staff] FROM lutStaff WHERE Staff <> name3
SELECT [staff] FROM lutStaff WHERE Staff <> name4
SELECT [staff] FROM lutStaff WHERE Staff <> name5
SELECT [staff] FROM lutStaff WHERE Staff <> name6
The issue is that the box is not filtering all the names out of the list it is built on. It is only filtering out the last name.
Obviously I need to save the results for comparison, but I am at a loss on how to do that.
View 10 Replies
View Related
Jul 21, 2015
I have a combo box that populates many listboxes based on a selection (listbox values are coming from another table [Master]) - simple enough. I want the listboxes to populate with DISTINCT entries - also seems simple enough (right?).
As you'll see below, if the user selects "All" from the combo box (cboSite), I want the listboxes to populate with distinct values from all sites; otherwise, any other selection is a unique site and the listboxes will populate with distinct values based on that unique site.
This works BEAUTIFULLY if I select a unique site, but when I select "All", there is always one (and only one) duplicate value in EACH listbox. That is to say: all values but one in the listbox are distinct.
FOR EXAMPLE:Select unique site (not "All") from "cboSite"
The listbox "lstMajEquip" (which only has values "Yes" and "No") populates to show "Yes" and "No"
Select "All" from "cboSite"
The listbox "lstMajEquip" (which only has values "Yes" and "No") populates to show "Yes","No", and "No" (what?!)
As mentioned, this happens for all 8 of the listboxes, not just "lstMajEquip"...
Using Access 2010
Code:
Private Sub cboSite_Change()
If Me.cboSite = "All" Then
Me.lstBusiness.RowSource = "SELECT DISTINCT Master.Business, Master.Site, Master.Exclude FROM Master WHERE (((Master.Exclude)=False) And ((Master.Business) IS NOT NULL) And ((Master.Business)<>''));"
[Code] ....
View 7 Replies
View Related
Jul 15, 2013
I'm using a sub form to display data form a table. The users wanted it display like a spread sheet. In order to get all the data to display on the same page I am trying to break some of the longer feilds out (i.e. comment field) and display them in a list/text box and not in the table with the smaller fields.
Basically what will happen is when a record is selected in the sub form the comment field tied to each record will be displayed below. I've tried a few things but I keep getting errors displayed in my list/text box (#Name?)
View 14 Replies
View Related
Jul 27, 2015
In the past a Teacher would manually create a Form (Student Form) containing Student information, (Name, Gender, Birthdate, Homegroup) as well as additional issues on the student. This would all be saved into a table.
I would like to change this manual process of typing in individually to each text box, therefore, I have been able to run a report from a external program that obtains (Name, Gender, Birthdate, Homegroup). This saves as CSV and I am able to import into a separate table within the database.
This works no problem.
What I have set-up is a form that contains a listbox this contains the Student name and Homegroup from the imported table contents. Again this works fine.
What i would like to do is when a student is selected from the listbox and dbl clicked on, how can i make information (Name, Gender, Birthdate, Homegroup) populate the textboxes in the Student form that the teacher previously used? could this be an update query where the imported table information will then go into the Student form? If so, how can I tell the dbl click of highlighted name is the data i want to populate?
View 1 Replies
View Related
Nov 21, 2013
I am trying to write a code that will execute at the change even of the combobox/Listbox and when a character is typed in it then all the data from "DocumentType" field whose first character matches with the first character typed in Combo/Listbox will be stored in it.
The following code doesn't work:
Private Sub ComboBox4_Change()
Dim strText, strFind As String
strText = Me.ComboBox4.Text
If Len(Trim(strText)) > 0 Then
strFind = "BarcodeRef like '" & strText & "*'"
End If
[Code] .....
View 1 Replies
View Related
Oct 5, 2012
I have a listbox that is populated with data from a table. I would like to use one of the columns data as the where clause of a sql string that will populate another form, how do I get the selected items column data that I need into a variable? This is in Access 2010 vba.
View 9 Replies
View Related
Aug 28, 2013
I am trying to populate a textbox from a field in a table based on clicking on a item in a listbox. User clicks a name from the Client table in the client field, and the date that is stored in the orderDate in the same row. I want the text11 textbox to show that date.
View 9 Replies
View Related
Apr 21, 2006
Hi, I'm new here, so I hope I'm posting this in the correct place. I've searched the forum to see if there are any existing threads that might help me, but I've not found anything that does...
(I think this thread ( http://www.access-programmers.co.uk/forums/showthread.php?t=93444&highlight=Copying+data )may be trying to achieve something similar to me, but I'm a beginner and don't really understand it)
I shall stop waffling! I'm not entirely sure that what I'm trying to achieve is possible, I expect it probably is!
Right, I have a form (frmGroupRegister, which contains exactly the same fields as the table it comes from, tblGroupRegister), which consists of three things:
-GroupDate - The date a group took place on. It is my primary key, as no more than one group occurs on a specific date.
-ParentList (A listbox which contains a query showing the ID number, forename and surname of everyone in a table, tblParentDetails)
-ParentsAttending (A blank listbox)
I would like to place buttons in between the ParentList and ParentsAttending, which would allow users to conduct a 'register' of attendance by copying individual/multiple details from ParentList into ParentsAttending (much like you get when choosing which fields to include in a form when using a wizard for example). I would also like them to be able to remove people from ParentsAttending by using a button in case of accidentally adding the wrong person into the ParentsAttending box.
I'm aware that another, probably simpler way of achieving this would be to use a tick-box system, but I feel that visually, the first method would both look better and demonstrate who is present more clearly.
Any help would be much appreciated, but my Access skills are quite basic and things will probably need to be spelled out for me.
I'm using Access 2000 and Windows XP.
Thanks for your help,
Alice :)
View 1 Replies
View Related
Jun 10, 2015
I am using the selections made of the form to generate a query for the user.
I have a CITIES listbox that is populated with values from a stored query.
I would like to make it multi-select and populate a LOCATIONS list box and a NAMES list box based upon the CITIES that are selected.
I have the locations currently populated from a stored query that reads the City selection from the Form. It looks like this
Code:
SELECT DISTINCT (t_location.LOCATION) AS Expr1
FROM t_location INNER JOIN t_asset_master ON t_location.LOCATION_PHY_ID = t_asset_master.LOCATION
WHERE (((t_location.CITY)=[Forms]![MasterQueryGenerator]![CityList]));
I also want multi-select so that is you can un-select all and get the results for all cities.
Here is my half thought approach.
Code:
Private Sub CityList_AfterUpdate()
'Dim LocQryStr As String
'Dim r As Integer
'Dim ctl9 As Control
'LocQryStr = "SELECT DISTINCT (t_location.LOCATION) " & _
[Code] ...
I intended to have the variable LocQryStr as the row source but I abandoned the idea of having multi-select when I saw that .Selected(I) never returned true. Its like the values aren't read in this subroutine.
View 5 Replies
View Related
Sep 9, 2013
I have a list box called "product list box" based on a query called "searchqry", i also have another listbox called "type list box" , how do i get the type list box to only show "types" based on the section in products list box?
View 1 Replies
View Related
Dec 14, 2014
Using a popup form
1. On my main form, I have a listbox, I would like to edit the values of the listbox.
To do this, I have a popup form with 2 listboxes, one to have the values of the listbox on the main form, and the other listbox with option values for the 1st
1) how to i pass the rowsource sql of the listbox on the main form to the listbox on the popup form
2) how on closing the popup form, do i update the rowsource sql listbox on the main form from the changed value of the popup form listbox rowsource sql
View 3 Replies
View Related
Oct 23, 2013
Okay then, after much trouble and confusion, I finally realized I need to use an Extended listbox in order to allow for multiple items to be selected from a list on my form (rather than the evil multiple selection combobox!).
However, now I am trying to figure out how to make one listbox (IndustryClassification) only be visible if the item "Industry" is selected in another listbox (TypeOfBusiness). Coding I can use for this in the AfterUpdate event of the listbox?
View 7 Replies
View Related
Jun 17, 2005
Hello,
I've got this multiple select listbox which writes data into a textbox:
Private Sub List2_AfterUpdate()
Dim Cursisten As String
Dim ctl As Control
Dim Itm As Variant
Set ctl = Me.List2
For Each Itm In ctl.ItemsSelected
If Len(Cursisten) = 0 Then
Cursisten = ctl.ItemData(Itm)
Else
Cursisten = Cursisten & "," & ctl.ItemData(Itm)
End If
Next Itm
Me.txtCursisten = Cursisten
End Sub
And I've got a SELECT ALL button to select all records in the listbox:
Private Sub cmdSelectAll_Click()
On Error GoTo Err_cmdSelectAll_Click
Dim i As Integer
If cmdSelectAll.Caption = "Alles Selecteren" Then
For i = 0 To Me.List2.ListCount
Me.List2.Selected(i) = True
Next i
cmdSelectAll.Caption = "Alles De-Selecteren"
Else
For i = 0 To Me.List2.ListCount
Me.List2.Selected(i) = False
Next i
cmdSelectAll.Caption = "Alles Selecteren"
End If
Exit_cmdSelectAll_Click:
Exit Sub
Err_cmdSelectAll_Click:
MsgBox Err.Description
Resume Exit_cmdSelectAll_Click
End Sub
The only thing is that when I use the SELECT ALL button, the function List2_Afterupdate doesn't work anymore. There must be a simple solution but I just can't figure it out. Can anyone please help me?
Tnx a lot!
View 13 Replies
View Related
Jul 16, 2006
Hello everybody,
Hopefully somebody can help me on this one. I searched the whole internet and access forums, but I didn't find the exact solution for my problem.
I've got a table with students, a table attendance, where I now only save the students who are absent, but I would like to save also the students who are PRESENT (at the same time).
I've got a combobox where I filter the Class, which then updates a listbox with the students from that class. What I do now is select the students from the listbox and then press a save button and it saves the records to the table absence with STATUS: ABSENT.
I would like to save the NON selected students also in that table, but with PRESENT in the column STATUS.
I thought of making another listbox next to it, where after selecting the absent students, they wil apear and disappear in the PRESENT table so I can store all the information.
But the only problem is that I can find this solution when the listbox is populated by a list of values instead by a table or query. And the other solution is to store the temporary data into 2 different tables, but that's not working for me because it's a multi user database and everything will be messed up.
Hope that someone can help me, I will be very happy.
View 4 Replies
View Related
Jan 20, 2014
Firstly, is it possible to hide unchecked values in a listbox? I have a user with several roles and I want to only show the ticked roles in the listbox.
Secondly, can you create a hyperlink on listbox values? i.e, if I click on "Manager" in the roles listbox, it follows that to another form and opens the record about managers?
View 10 Replies
View Related
Mar 25, 2007
Is it possible to populate several fields on a form via a Nma e selected from a list box ie: the list box has several names in it, the names have data from another form (user details) such has Payrole No:, Holiday entitlement, etc.
I want to select a name from the List Box and have it populate (enter) data into field in the form being used.?
View 5 Replies
View Related
Sep 17, 2006
Hi I am new here. This is probably an easy question but I have not been using access long and would appreciate some help. What I want to do is query two tables. The first table has fields INST_NBR and PRICE_LIST that I need to find a match on in another table with the exact same field names. Whe a match is found, I need to populate a new table that is already defined with fields from both of the tables I used in my query. So lets say I have table 1 and table 2. I want to use the fields INST_NBR and PRICE_LIST from table 1 to find the match in table 2 using the same field names. When I find a match on the two fields populate table 3 with fields from table 1 and table 2.
I hope that this is not confusing. Unfortunatly I cannot post a sample because they are linked table from our SQL server. Any help would be appreciated. Thanks in andvance.
View 4 Replies
View Related
Aug 25, 2005
What I’m trying to achieve is a database that I can enter the number of calls a salespersons makes in a day. Please find diagram below.
<< Date >>
,,,,,,,,,,,,,,,,,,No-Calls
Name
Ben,,,,,,,,,,,,,,,1
Bob,,,,,,,,,,,,,,,2
John,,,,,,,,,,,,,,3
I have kind of got one working but when I create a new day I have to type in all the names every time and it get a bit boring. Can anyone point me in the direction of how to auto populate the names of salespersons when I ad a new date ?.
I have attached a quick mock-up of what I have got so far so if I haven’t explained myself very well hopefully you can see what I’m gibbering about.
Any help would be much appreciated.
Thanks, Mary
:confused:
View 1 Replies
View Related
Mar 6, 2006
Hello all,
I have a passthru query which pulls in data from SQL Server for further processing on the agents machine. I would like to create a form with a text box that displays that sql code in it, so they can see it without having to open the query in design view. I would also like to have a button on that form that allows them to save the query, overwriting the previous passthru query, as a new passthru query. Any recommendations?
Thanks!
Vassago
View 1 Replies
View Related
May 5, 2006
Hi all,I tried looking for an answer to this but I haven't found anything yet. I have a form that features a 'Bill To' and 'Ship To' section with 'City, State, Zip etc..' for each one. I'm triyng to create a button that my users can press to automatically copy the data from 'Bill To' into the corresponding fields in 'Ship To' to save time if the data is the same. I tried creating an update query but it seems to confuse the form code and throws errors.Any help you can give me would be appreciated.
View 5 Replies
View Related