Combo Box in Ms Access does not dispaly values - ms-access

I have a comobo box in ms-access whose record source is a query:
select WeightUOM from Ctr where WeightUOM="lbs" or WeightUOM="sh t".
When I run my form the combo box does not display any value.Although running the query independently fetches correct result.
Thanks!!

Related

MS Access - Expression not identifying contents of combo box?

I am very new to MS Access and am trying to get an expression in a query to use the selected text in a combo box, however when I run the query a blank is returned for the selected field. The intention is for the user to be able to select an option from the drop down list in the combo box and then press a button to run the query to bring up all info on that option. The expression is as follows:
[Forms]![Policy_Interactions_Form]![PA1Combo]
What could be causing the expression to return blank values when I can see a selected value in the combo box?
When viewing the query in SQL view it looks like this:
SELECT Policy_Interactions.[Policy Area 1], Policy_Interactions.[Policy Area 2], Policy_Interactions.Interaction, *
FROM Policy_Interactions
WHERE (((Policy_Interactions.[Policy Area 1])=[Forms]![Policy_Interactions_Form]![PA1Combo]) AND ((Policy_Interactions.[Policy Area 2])=[Forms]![Policy_Interactions_Form]![PA2Combo]));

MS Access using ApplyFilter from Macro Builder with combobox shows input parameter box

This time I'm trying to work on an MS Access application. I have a split form populated using a SQL query. Now I want to filter this form using a combobox which is located in the header of the form. This CB is also populated with a SQL query:
SELECT DISTINCT [ConsultQ].[ClientName] FROM ConsultQ;
I have added an embedded query to this Combobox which should filter the form. The values shown in the Combobox are correct. But when I select a value from the box a popup show which asks me for input.
The ApplyFilter action is set to:
So, apparently, the ApplyFilter action cannot retrieve the selected value of the Combobox. What am I doing wrong here?
When I enter a name in the input box, the filter is applied correctly. So the filter works, but I cannot set the filter using the selected combobox value.
It must be something simple, but I cannot find it.
I'm using MS Access Office 365 version.
Remove the [Text] property. You want [Value] and [Value] is the default so doesn't have to be explicitly referenced.
Also need full path reference to combobox.
Forms!yourformName!cboClient
However, really should use ClientID to filter records. If the combobox has ClientID as first column and first column is set as the BoundColumn, then combobox value is ClientID, not ClientName.

displaying query results on sub form in MS access

I have a Form A (Main form) with combo box taking values from a account master table. Whichever value a user will select from combo box is displayed on the same form in 2 text boxes. Now on pressing a button (On Form A) a query A runs after taking the values in 2 text boxes as inputs.
The results are displayed correctly in a separate tab created automatically in datasheet view.
However I want to display the results on a sub form on the Main form A. I have bound this sub form with the Query A and have placed this sub form on form A.
But still the query results are getting displayed in a separate tab and not on the sub form which seems to do nothing.
Please help.
If the results of the query that you are using as the Source Object for your subform are using the values of the comboboxes as query criteria, you may need to call SubformName.Requery after changing the combobox values.
If instead you are modifying the SQL behind your query rather than using criteria, I have found that you need to issue the following in order for the results to update:
SubformName.SourceObject = Subform.SourceObject
In my experience, when the SQL behind a query that is used as the Source Object for a subform is modified, the data displayed by the subform is not updated following a call to .Requery, but only after the SourceObject property is 'refreshed' using the method shown above.

Synchronize two multi select combo boxes on a form in MS Access 2007

I am working with two multi select combo boxes on an Access 2007 form. The first multi select combo box is a list of Diagnoses called cboPatDX. After the user selects any number of Diagnoses, I want to fill the next field called DXUnclear with just the selections made on cboPatDX. Most of the answers I have found online do not apply to the multi select combo box. Among many options I have tried, this is the latest, but I get a type mismatch error:
Me.cboDXUnclear.RowSource = "SELECT ID, Diagnosis FROM tblOptsWorkingDX WHERE ID = Me.cboPatDX ORDER BY Diagnosis"
Me.cboDXUnclear = Me.cboPatDX.ItemData(0)
I would appreciate any help with this, including other methods to make this work.
Here's two links that might help you:
filter a query based on multiple list boxes in a form
https://bytes.com/topic/access/answers/446193-filtering-query-values-multi-select-list-box

How to use a query as a source for a report in MS Access 2007?

I did the following in MS Access: I made a form which had a combo box and a button. You select an option from there and click on the button and it is supposed to open a report. Now, I wrote a query selecting a few fields from a table and in the where clause, gave the condition as where name=str(combo1.value) and the report source was specified as this query. Now, when I select the value and click on the button, it opens a blank report. How can I make it load only those particular values?
I am not saving the combo box value anywhere. It said that it would remember the value for later use. Am I doing the right thing by not saving it? What should I do to make this work? Please help me!
Edit: The combo box is using values from a column 1 in a table X. I've not bound the value to any field and am using the "Remember the value for later use" option provided. The combo box is essentially a list of hotels and the report is a list of people staying at the selected hotel. When I put the ID of the field (as defined in the X), it works. But the thing is, it should refer to the names of the hotels and not the ID, which I am supposed to enter in a popup that asks for it. What do I do?
Edit 2: The query is as follows:
SELECT Table_1.Hotel_Name, Table_2.Name_of_Delegate, Table_2.Address, Table_2.City, Table_2.Center, Table_2.Spouse_Present, Table_2.No_of_Children, Table_2.No_of_Guests, Table_2.No_of_Rooms
FROM Table_1 INNER JOIN Table_2 ON Table_1.ID=Table_2.Hotel_of_Residence
WHERE Table_1.Hotel_Name=FormName.Combo7.Text;
When I click on the button (which opens the report), it asks for the name of the hotel in a popup box. How can I avoid this? What I am doing wrong?
You can use a WhereCondition with the DoCmd.OpenReport Method as a "dynamic WHERE clause" for your report's record source. Use something like this in the click event of the command button which opens your report.
DoCmd.OpenReport "YourReport", , , "[name]=" & Me.combo1
Remove the WHERE clause you added, where name=str(combo1.value), from the report's query.
I surrounded name with square brackets because name is a reserved word. See Problem names and reserved words in Access
Edit: In a comment, you said this about the combo box:
"Row Source is SELECT [Table_Name].[ID], [Table_Name].[Name] FROM [Table_Name];. Bound Column is 1 (which I assume shows the names I wish to be displayed in the combobox.)"
When you refer to the value of a combo box, that value is the value of the "Bound Column". So in your case, the bound column is 1, which means the combo value will be [Table_Name].[ID]. However, you want to open your report based on the [Name] column of the combo. So change the bound column of the combo from 1 to 2.
To open a report using the value of your combobox, in your report query you need to do the following:
SELECT fields
FROM table
WHERE YourValue = [Form]![FormName]![ComboBox Value]
You have to specify the name of the Form, plus the value so the report query knows the value. Hope this helps.