I have a ms-access database, now I need to build a search form on table "Samples" .
Now, the difficulties are I need 4 search criteria, SampleNo, SampleDate,SampleClient,SampleBatchNo.
The search criterias can work together or not.
I have a listbox to show the search results, and I want to be able to select more than one records in the results set and open a new form with the limitation of the selected records only.
Thanks
Shuolinq,
I answered a similar question yesterday here...
Populate list box from a table in vba
The only difference between that question and this one is that your rowsource will have multiple of those "Like" lines, one for each of your possible search terms and each pointing to a different control.
As for the second part of your question...opening a form using the selected results...that is a lot tougher. It can be done but only with VBA code.
Seth
Related
I have a query in MS Access that pretty much has every data I need for different reports. I know how to filter the query from a combo box in a form, however, I can't do it from multiple forms. Let's say for one occasion I want to filter the query from one form but for another purpose, I want to filter the same query in a different field from another form. When I try it there is a window that pops up asking for the criteria in the other field. Bear me with my English is not my first language.
Respectfully
I have tried several different ways of searching for this information with no luck so far...
Firstly, I am using Access 2013, and I wouldn't exactly call myself experienced with it...
I have a table with many fields and I want to be able to create a report dynamically that only uses a subset of those fields. The subset is to be determined by a ListBox (with multi select turned on) containing the list of all of the fields.
So, a user will:
Opens the filtering form that was created
Selects the fields they wish to view
Clicks "Generate Report"
The report will only shown the fields that were asked for
Is this possible? If so, how?
I just started to use Access with vba. I have table with roles, years and its workload of each role in this specific year. Each record in the table is IDRole, IDYear,Workload (number).
I display the table in a form doing a crosstab table where the years are in the columns and the roles in the rows. The number of years can increase.
My problem is when I add new years and display in the columns, it doesn't appear in the form so I have to select from the field list manually but I would like to know if there is any way in VBA that when the form is load, automatically appears the new columns (years).
I misunderstood your situation. Your form's crosstab data source is actually a table instead of a query. And as you add columns to that table, you want the new columns to automatically appear in the form when you next open the form.
In that case, use the approach described below, but where I selected a query (Query.qryFoo2) in the Source Object dropdown, choose your table ... Table.YourTableName ... in that dropdown.
The last 2 paragraphs below apply whether your data source is a table or query.
If you have your crosstab query saved as a named query, you can use it as the Source Object for a subform control.
Then when you switch from Design to Form View, the query results will be displayed in Datasheet View within the subform control.
As the number of columns changes over time, that Datasheet View can "automagically adapt" to display them ... the same as if you opened the named query directly in Datasheet View.
As far as I'm aware, there is no other reasonably simple way to accomplish what you want. If this suggestion is not suitable, you can explore programmatically adding bound data controls to your existing form after examining the set of fields the query currently returns. But that is way too much effort IMO.
I have exactly the same issue, I have a form which I use to show a Query, And I can't anticipate the number of columns from the query.
I found the same topic on other pages, and for the moment the only way I found is to build an excel file based on the query.
Another way also is maybe to directly open the crossTab query using vba.
Okay, so I'm creating a new database, and I've written several queries that I now wish to link a form. A partial view of the form will be attached
What I want this form to do is when the user selects the manufacturer the model box will be a drop down with only models linked to that manufacturer
IE: If the user selects Dell they will get a list of only Dell products that I've added to the model table in the database. If they select apple, they'll only get apple models, and so on.
I have the queries written to separate the data already, I'm just lost at the syntax needed on the source control for the forms.
I've looked around Stack Overflow and found nothing, and I checked the msdn to see if I could find any clues, so far I've not been able to figure this out, so now I'm asking for help.
The setup you need is what is called as Cascading ComboBoxes - Filtering the records in one combo box based on the value selected in another.
With this, you will be editing the rowsource of the next combobox that follow, so it will be more like a filtered list, that gives you more flexibility to choose and filter. Hope this helps :)
It should be something like this:
select Modelname
from Models
where Models.Manufacturer = [Forms]![ManufacturerField].value
I am trying to write an Microsoft Access query from a form with a multi value field being the criteria. The field I am trying to use is called Population and the field is represented in my database as a List Box that allows multiple values and it is in the Building table. The values it allows are the following:
"Singles";"Familes";"Families with Children";"Youth/Young Adults";"Veterans";
The form that I am creating is called HousingSearch.
I am trying to create a form which uses this field, so someone could use the list box and check off the values they want and click on the button which would open a query. I know having done this with single value fields the criteria in the query looks something like
[forms]![HousingSearch]![Building]![Population]
but if you try the same thing for a multi value field nothing is returned for the query. Any help would be appreciated.
From the information you have provided it seems that the phrase [Forms]![HousingSearch]![Building]![Population] are combining a request that starts with a form and then jumps to a table.
You are asking access to find data in a form but the information you're most likely trying to access is in a table. I don't quite understand what you're end result is but I think that you most likely want to refer to your information this way [Building]![Population]. Referring to your data this way makes access look at the table of [Building] and then into the field of [Population].
It's been a while since you posted, if you haven't cleared things up already I hope this helps.