Modules & VBA :: Query Results To Populate Combo Boxes
Sep 24, 2013
My company is finally using my accounts package (alongside our original package until we can be certain there are no bugs).
Anyway just adding nice to have features at the moment.
I've got a form that has 5 combo boxes where the user can select 5 customers. Then a button so they can graph the amount of money generated by each customer and compare them.
I've just made a query to return the top 5 highest grossing customers.
What I what to do now it feed the query results into the combobox values when I press a new button on my form.
I have several comboboxes (6) on my form.How to populate these comboboxes with values depending on selected value in previous combobox.
Example.Lets say that you select value "Audi" in combobox 1, then available values in combobox 2 should be "A4","A6","TT" etc. and if you selected "BMW" in combobox 1, then available values in combobox 2 should be "3-series", "5-series" etc...
I need to populate a text box with data from a single cell contained in a table.Im hoping to use two combo boxes that when selected will select the cell. The combo boxes select data sources from the same table. One combo the row the second the column. One combo is already in use and populates several fields in the form. In the same form I'd like to place the second combo and beneath it have a text box that will populate with that cell detail.
I'm using three combo boxes - The second (cbosubSkillList) is limited by value selected in the first (cboSkillList). The third (cboSubSkillList2) to be limited by value selected in the second. The third will not populate - If I comment out the code, It WILL populate will all values, but will not populate with code active. All names, properties, etc. with combo boxes, tables, field names parallel - Why am I not populating the third box?
[Code] Private Sub cboSkillList_AfterUpdate() With Me![cboSubSkillList] If IsNull(Me!cboSkillList) Then
I am a self-admitted beginner so go easy . I have a query populated with all of my data. I am building a form based on two columns in the query: Pick Up Name, and Deliver to Name. Lets say I have records for company XYZ picking up at location A three seperate times, location B once, and location C four times. On the form I want to have my first combo box listing all the names of column "Pick Up Name". When I scroll down and select company XYZ, I want my second combo box to only display the three locations where company XYZ has picked up: A, B and C. Then I want the option of selecting either A, B or C and in a third box, display total number of times that company XYZ has picked up at selected location.
For example, I select company XYZ from the first drop-down. I select C from the second drop-down, from the list of three locations. I get a result of four, because company XYZ has delivered to location C four times.
Right now, I have my first combo box with the Pick Up Name data, where do I go from here? Any help or nudges in the right direction greatly appreciated!
I am working on a database where law clerks input the tasks that they accomplish each day. They use a form called "TaskDetails" to input all of the information related to their daily tasks via combo boxes. The problem I have is: often times the clerks work on the same task more than once and I would like them to be able to continue tasks already in progress - using notes to indicate what particular portion they completed that day.
In order to do this I would like to have a combo box that is based on a query of all of the tasks the clerks have completed. When they select a Task Name from the combo box, I would like all other combo boxes on the page to auto-populate based on the selection.The query that my combo box is based on includes all relevant fields.
When I click on the "Task Name" combo box I am presented with all of the records related to tasks. The fields/columns are divisionofwork, subcategory, workassignedby. I have combo boxes for all of these fields on the same page, bound to the table of tasks. Ideally, a clerk makes a selection from the "Task Name" combo box, and the subsequent 3 combo boxes will reference their relevant column in this selection and auto-populate.
I have a data entry form that is also used for editing exsisting records, upon the opening of a record the form populates with all the data of the record apart from what is previously selected in combo boxes, so I need to find a way to re-populate those comboboxes?
I have a form called frmPO based on a table called tblPO One of the fields in tblPO is linked to the field idAddress in the table tblAddresses
The following fields exist in both tblAddresses and tblPO Company Address1 Address2 City ZP State
The form contains controls for these fields on tblPO. I would like to give the user the choice to either enter a shipping address manually, or selecting a preregistered address from tblAdresses. For this I would like a combo box showing the values of idAddress. I f a user selects a preregistered shipping address, I would like the form to fill the rest of the fields based on the value of this control.
My understanding is that I should set a BeforeUpdate event to set the values of the different controls, unfortunately my command of VBA amounts to 0.
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.
Table 1: two columns - Child Tag and Parent Tag. Parent Tags can also be in Child Tag column. In other words, a parent can have multiple levels of children.
Table 2: one column - Backup Tag.
I'd like to have a form with a combo box, pick a Parent Tag, the search all its child tags and compare each Child Tag found with records in Table 2 to see if there is a match. Then populate all results in a tree view control.
A visual example :
Parent Tag ...Child Tag 1 - Back up tag found ......Child Tag 11 ......Child Tag 12 - Back up tag found ...Child Tag 2 ......Child Tag 21 ...Child Tag 3 ......Child Tag 31 .........Child Tag 311 - Back up tag found
Ok, i have tried and searched but could not find a good start to a solution for my problem. I have a calendar form, which shows the dates and under it text labels. Now whenever something is present in my table (tblKalender) on those dates, i want it to show in the text labels under the correct date. Now, i have the results through a query, but i dont want to link the query to the form. Only thing that i have trouble with now is getting the information i need to show to those labels. I have written some code (early stages) which i want to show me the results for testing, later on i can fill the fields. I keep getting an error saying not enough parameters, expected is 1.
Can anybody take a look at the code or help me with this? My query for day one is called qerKal1 and the fields i need to get back are the hour and the task. The query gets it's criteria from the label above that day (lbDag1), which shows the date.
I have this code in a module and when the form is opened it runs the fucntion.
Attached I have a database that I've been working on which has a form called "frmCriteriaSearch". It is based off of the qryCriteriaListBoxUpdate query. I am trying to get the listbox in the second tab of the results section to work. It queries fine for the checkboxes, but I cannot get the comboboxes to affect the query (unless a checkbox has already been selected)
I have a form with ID, town and address on it. I want to beable to type in an ID, press enter then if the ID exists in a query then populate the town and address text boxes with the correct info..
If the ID doesn't exist, then open another form so the user can choose the site from the list..
At the moment I think I am going about it the wrong way :
I am running a simple query. Three Fields Customer Standard SLA Non Standard SLA
The two SLA fields are Check boxes. I wish for the query to bring back only the customer name if the check box is ticked. I have tried putting Yes, True and -1 in the criteria. Some come back with no results and others come back with all the Customers listed even though not all have the field checked. What should my criteria be to only show the checked boxes. What am I missing?
I need to give users the ability to change the font of a field in a report. The field shows a barcode.
I thought of using the CommonDlg class to show the Windows font-selecting dialog box, but installed barcode fonts show as a barcode. I need to show the font name.
So I need to populate a combo box with the names of all fonts installed on a computer. The fonts reside in C:windowsfonts
I have searched Google for a solution but cannot find one.
How do I populate a combo box with the names of all fonts installed on a computer?
My database will be creating quotes based on employees entries. Each quote will be unique because of the part. Each part has the potential to have Precious Metals, and Base Metals included. The employee must select the number Precious Metals and Base Metals that a particular part has. The problem lies with what happens after this selection is made. There are three fields that need to be defined pertaining to each metal. I need the number selected to determine how many fields to make available. If there are two precious metals, I need to make the three fields available twice; one for both metals. I have the possibility for up to 5 Precious Metals and 10 Base Metals per part. How can I make the selection from a combo box populate that number of Metals Fields?
I have an unbound combobox on a form that is used to filter the records of a subform based on who they have been assigned to. The combo box is based off of a query to the personnel table and utilizes a UNION querry to add the option "**ALL**" with a id number "111111" as the first option in the combo box.
In other words: the combo box has a list of names to choose from and the word "ALL" at the top as the first selection. The idea is that when "**ALL**" is selected, the subform should display all records regardless of who they have been assigned to. I'm trying to accomplish this with VBA. I've started developing the code to try to impliment this, however currently when "**ALL**" is selected, I'm getting a datatype missmatch that seems to be caused by my use of recordset.
I have a Inventory DB and i want to integrate scanning. So far i have a table called StockInfo, this table holds information about bar codes (device type, make, model). I have a form called Scan_Barcode, on this form I want to be able to scan a bar code into a text box (text0) and use a afterupdate and requery function to display the results onto a form called EnterInventory.
Not only just the results but I want certain columns from the query to display in certain text boxes on this form. I have a query called FindProduct. that filters the criteria by whats entered on the Scan_Barcode text box (text0). So when i scan a certain bar code i can get the query to display certain product information for the bar code. I just cant get the results onto the HarwareStock form.
I have a sub form that I enter date range in 2 text box's txtstartdate and txtenddate this is filtering field "date raised" and I have combo box call cboclient this is filtering field "client name" this code is behind a command button after hitting the command button it open's the report and it show's all records with in the date range and with client name enter in cboclient works great. problem is I have now added another cboclient2 to filter client name twice so now I enter a date range in txtstartdate and txtenddate put a client name in cboclient and a client name in cbocleint2 hit command button it open's the report but doesn't apply the date range to cboclient2 it just show's all records with that client name
Code: Private Sub cmdPreview_Click() 'On Error GoTo Err_Handler 'Remove the single quote from start of this line once you have it Dim strReport As String Dim strDateField As String Dim strWhere As String Dim lngView As Long
I'm attempting to filter my form with combo boxes. I've added the below code, but the if statement that checks if one of the combo boxes is null won't work. If the combo box is null or "", it's supposed to assign a wildcard to the variable. But it doesn't pass the test and goes straight to the Else statement. I've highlighted the if statement that keeps failing in red.
Code: Private Sub btn_Search_Click() 'create variables to store the combo box values Dim str_Country As String Dim str_Vendor As String Dim str_Survey As String
I have a form with textboxes and comboboxes and a Button,when button is clicked, a new query is made, with criteria based on boxes on form.For example this one :
Quote: If Not IsNull(Me.cmbType) Then Where = Where & " AND [TypeID] = " & Me.cmbType
What would be the statement for a range between to combo boxes.I have 2 comboboxes (cmbBox1 and cmbbox2), show only records equal and between the ones selected in cmbBox1 and 2.
I have a form designed to update content on a website. I'm trying to work out how to populate fields with entries from past dates.
I have set up two combo boxes for each 'spot' on the site, one for date: Feature_1_Date and one for which content spot the content was occupying Feature_1_Spot.
The idea being that these boxes would read the row from my table to find the date, and the column to find which spot the content did occupy to copy the same content into a field Feature_1_Content
From what I can gather I need to use DLOOKUP (I'm very familiar with VLOOKUP on excel) but I'm doing something very wrong as can't get it to show any content.
tbl_Retainer tbl_Retainer_Grant_Funding tbl_Retainer has the field, Retainer_ID
And tbl_Retainer_Grant_Funding has the fields, Retainer_ID (a lookup field from tbl_Retainer) Agreement_Num (a lookup field from tbl_Grant)
I have a form based off of a query(not sure if that matters), that uses that tables, tbl_Assignment and tbl_Assignment_Grant_Funding. These tables have the above fields as lookup fields.
So...what happens is, if an Assignment has a Retainer, I want the Agreement_Num box to show only the Agreement_Num's associated with that Retainer, otherwise just show all the Agreement Num's.
In my form, I have Retainer_ID with the row source, SELECT tbl_RETAINER.Retainer_ID FROM tbl_RETAINER;
And Agreement_Num with the row source, SELECT [tbl_GRANT].Grant_ID, [tbl_GRANT].Agreement_Num FROM tbl_GRANT ORDER BY [Agreement_Num];
In my AfterUpdate event for Retainer_ID I have,
Private Sub Retainer_ID_AfterUpdate() Dim strSql As String strSql = "SELECT [Retainer_ID]," & _ "[Agreement_Num]," & _ "FROM tbl_RETAINER_GRANT_FUNDING" & _ "WHERE [Retainer_ID] = " & Me.Retainer_ID.Value
Me.Agreement_Num.RowSource = strSql Me.Agreement_Num.Requery End Sub
When I am in my form and choose a Retainer ID, the Agreement_Num box goes blank, and there are no choices to choose from. I am wondering if this is because the Agreement_Num's are sourced from tbl_Grant and not from tbl_Retainer_Grant_Funding.