Variable input from Form when opening Report - ms-access

Exist:
A query with data and one of the columns is criteria based off of user input (i.e. [please choose a number:])
A report, based on that query, that asks for the same user input when opened.
A form with buttons to open said report and others and also a combo box based on a table.
Is it possible to make it so that when the button was pressed (to open the form), while a value was picked in the combo box, then the report that is loading will use the combo box value instead of asking the user for input?
I tried creating such action with both the Macro Builder and the Expression Builder in the OnClick button property. But failed.
Is this attainable in VB code? Is it even possible at all?
Thank you.

Assuming that the bound column of your combo box is the value that you wish to use to filter the query, simply change the query criteria from [please choose a number:] to instead reference the value held by your combo box, e.g.:
[Forms]![YourForm]![YourComboBox]

Related

connected combo boxes in continuous form - the second combo doesn't show its value if dependent on first combo how could I fix that

I have a Continuous Form that has two combo boxes. If I don't link them together all values appear but if I link the two combo boxes to make one of them depend on other for easier choose from, the values never show in the second combo. I try to make code with if condition in vba to requery the combo values to show in all records but I couldn't. How could I do that? Thank you for all what you do
This technique is known as cascading combobox. A very common topic. Be aware that if combobox RowSource uses an alias (displays text when saving ID) the text will not be available for display in all records when the list is filtered. This is especially disconcerting for users of continuous/datasheet view form.
Could have code that only filters second combobox when it gets focus then restore the full list when loses focus. Users will still see data briefly disappear from other records and may find distracting at first but will learn to disregard.
However, a workaround to maintain display of text is to include the combobox RowSource lookup table in a query used as form RecordSource. Bind a textbox to the descriptive text field from lookup table. Set textbox as Locked Yes and TabStop No. In continuous view, can size and position textbox on top of combobox to obscure combobox text but still show drop arrow (a "hybrid" control). In datasheet view the textbox will not be superimposed but text will be displayed.
If controls are superimposed, users accustomed to clicking into combobox text frame and typing input will encounter aggravation as the textbox will likely be the control they click. Tabbing to the combobox or clicking drop arrow will cause combobox to get focus and display over the textbox.

Set unbound combo box to match on full string for not in list event

I have an unbound combo box that gets it's row source values using a select query in VBA. The values shown are filtered by other selections on the form. If a value entered is not on the list I have a prompt to ask the user if they would like to add a new record. So far this has worked without any problems.
I overlooked one issue. If the "new" item is a partial match the selection defaults to the partial match entry. (Ex. I want to add part 4321437 but part 4321437-01 is already present.) How can I get the field to match using the full field?
I have tried playing with auto expand, allow value list edits, show only row source values, and inherit value list. Nothing seems to stop it from auto-filling. I have also tried clicking out of the field versus tabbing out.
If I remove my for key-down event that displays the list options with the arrow keys, it works. However, the customer would like to keep that feature.
Is there a way to have both?
Thinking outside the box, perhaps consider using a TextBox in place of a ComboBox.
This way, using the AfterUpdate event, you would have full control over how the entered value is handled: test for a match in your dataset using a simple query and branch accordingly.
You could even cycle through existing options by successively populating the TextBox with existing values from your dataset on the KeyDown event triggered by the arrow keys.
I found a way to have both. In my Key Down Event, I check if the down arrow is pressed. If it is, I display the drop down menu.
If KeyCode = vbKeyDown Then
Me![cboNewPart].Dropdown
End If

How Jump automatically to another report according to a value. Reporting Services

Reporting Services
I need to jump to a specific report according to the value that takes a variable data set.
For example: If the variable has the value = 2, then go to the report 'Informe_1' but if the value is = 4, then go to the report 'Informe_2', this automatically without having to click anything. That is a generic type of report which determines which of the 2 reports must be charged according to the value of the variable.
Currently I have in the properties of the variable, in action, go to report, but I need to specify the condition to be 'Informe_1' or 'Informe_2' according to the value of that variable (2 or 4).
I'm not aware of a way to automatically go to a specific report without the user clicking something; however, you can specify an expression for the Action on something and that way the user will get the report specified by your variable when they do click.
In Design view, right-click the text box, image, or chart to which you want to add a link and then click Properties.
In the item's Properties dialog box, click Action.
Select Go to report. Additional sections appear in the dialog box for this option.
In Specify a report, click Browse to locate the report that you want to jump to, or type the name of the report. Alternatively, click the expression (fx) button to create an expression for the report name.
Also, see Expression Examples (Report Builder 3.0 and SSRS) for more information about expressions.
You can also alter the visibility of a linked item similarly. To give an example, in some of my own reports I have a hidden #ReportParameter that I use to pass the report to return to when a Back link is clicked. If that parameter is empty I hide the link. I use Go to report and specify =Parameters!ParentReport.Value in the expression for the Action. For Visibilty with show or hide based on an expression selected, visible is false and hidden is true. That makes my Visibility expression =Parameters!ParentReport.Value = "".

MS Access combobox in a continuous form changes value for all rows when I change value for one row

I've been trying to solve this issue for the past 2 hours but in vain...
So I hope that you can help me with a solution to this problem..
I have a continuous form that shows many rows at a time, I added a combobox to the form that shows some values to choose from another table, while having the default value shown from the same table. Problem is, as soon as I change the value in one of the comboboxes in the form, all the other comboboxes changes value to the same one as the latter...
How do I prevent that??
Thanks a million in advance
Tony's right. You can't do what you want with an unbound control.
However, it's not entirely clear what your intent is based on your question. If changing the combobox should update a field on the current record, then you just need to make it a bound control. You would do this by setting the combobox's ControlSource property equal to the appropriate field in the underlying table or query.
I faced similar issue and got it sorted recently. I had created a tabular form and had introduced a combo box in the form, picking up values from a value list. Whenever I used to select a value of this combo box list, the selection used to get reflecting on all the records. To correct this, you should do the following:-
1) Introduce the combo box field in the source table of your form. Instead of clicking on the drop down box in the tool box, click on the Add existing fields link on the ribbon and select the newly added combo box field from the table. This will add a combo box field and a corresponding label in the form area. For a tabular form, you may want to delete the corresponding label and introduce a non-linked label in the form header.
This solved the issue for me. Hope it will be of some value to you.
May be a couple of years late and am pretty sure that it's been long since you figured out this problem,but it's good to leave it in the thread for someone,who may be in need.
Can't be done. This is one of the limitations of Access continuous forms and unbound controls.
Because of this strange behavior I just hide that field.
In the datasheet view:
Right-Click the field header that matches your combobox
Select "Hide Fields"
Now the person can see the records and they can use the form. They don't need a field for the combobox.

How to open a form in Access, automatically select a value in a combobox and display the detail?

A user can select a value in a combo box and the detail automatically loads into the forms fields. How can I automatically select a particular value when (or after) opening the form and get the detail to load?
I've managed to set the value of the ComboBox after opening the form, but the detail on the page doesn't change until I manually select a value in the ComboBox.
Is the subform built with code or more simply by setting the link master field to the combo and the link child field to the matched field for the bound column? For the most part, the second way is best as it does not require the After Update code for the combo to be triggered, which won't happen when the value is set via code.