Access filter won't show value list to choose from after 1st filter is set - ms-access

I'm having a little trouble with the form filter in Access 2007. I'm using the listview in a few forms and the user needs to be able to filter there.
For testing purposes I made a query, which is just based on one table. If I want to set the first filter, it looks like that:
I choose a value and if I want to set another filter (on a different field obviously), there aren't values available to choose from.
This seems to happen only if I use a query (doesn't matter if I use every field, or just a few, based on one table or multiple linked tables). I can of course use the number filter and enter a value manually.
I have another database, where I can use filters when and wherever I want, regardless whether it is a query or a table - I have a list with values to choose from everytime. This means I messed something somewhere up but I have absolutely no clue where.
I'm using Access 2007 (FE/BE), if you need any further details, just ask. Any advice where to start looking is very appreciated!

Well, after playing around for a long while, I figured out what the problem is.
The form recordsource needs to be a query - no sql code, no "select * from query", just the name of a query. Anything else leads to the fact that you are limited in using the filters. I'm not sure if this is a bug or if there is a reason behind this, but that's the way it works in access 2007 - at least for me.
Before I was dynamically adding conditions to my queries which led to a recordsource like "select * from qDeliveries where location = 1". To accomplish this I now just create a temporary query which is the form recordsource instead of just using the sql code.
Hope this helps anyone... :)

Instead of using a query, try this:
File >> Options
Current Database
Scroll down to Filter lookup options
Check ODBC Fields
Close and re-open the file. That should solve the issue.

Create a Separate query and assign to that form. instead of create query within the form. Your problem might get resolved. I did the same way it's working fine for me.

Related

MS Access Form Debugging

Hello I have a pretty intricate Access database. I just jumped on this project and have never used Access. I have a form that is generating a value entry popup when I try to run it and it shouldn't be. The problem is the form is trying to access a column of a table which has been changed recently. I just have no idea where to find the query or what exactly is trying to access that column. Any help greatly appreciated. I am using Access 2016 also.
Sounds to me like the problem inst actually your form but the query your form is based upon.
This may be a separate query or a query built in your forms record source.
Go to your form in design view. Open up the property sheet. (Under design tab) make sure the dropdown box has Form Selected and look at the Record Source.
The record source may state a query name, In which case you should remove the field/replace the field with another in that query.
Or if it says something along the lines of "Select ......" then just alter that query to not have the field you have removed/renamed and the problem should go away.
However it is worth noting that if you have sub forms it could be the record source of one of those.

combo box reference not working in access query criteria

I have a database built that, after all of the queries are done, it will spit out a form and I can filter through records and the relevant information will change as I filter through. To get there, I have to be able to reference a combo box located on my entry form (which contains all of the sales guys' ID numbers) in my queries. However, when I input the normal form reference in the criteria section '[Forms]![Entry Form]![ID]' and run the queries, it returns nothing. I figure that this is because in a lot of our live data tables, the ID numbers have spaces before or after them, which they have no spaces in the ID numbers listed in the combo box. I tried to use the trim function in my queries for the ID number field in the tables, but it still returned nothing.
Any advice on what else I can try? If more info is needed, ask away.
Change the Bound Column to 2, or whatever column it is in the row column, all under the property sheet data tab for combo box. It may be returning the ID rather than the text when selecting.
This is a case where the query designer isn't the best option. Instead, open it in SQL mode (there should be a dropdown in the upper left corner that allows you to change how you view the query) and change the WHERE clause to something like:
Trim(ID) = [Forms]![Entry Form]![ID]
It's not going to be very efficient, this is why you should never use bound forms because you can do the trimming on data entry and save on the overhead, but this should at least return data for you.
I figured it out!! The answer to my problem was I needed to manually type in the combo box options instead of importing the options from another table. For some reason that worked. Thanks for you guys' help again!

Microsoft Access Form To Query for Multi Value Field

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.

MS Access - using multiple queries in 1 report

I have about 35 queries in a large MS Access (2007) database that I would like to use in a report. However, I don't want to create reports for each query, but would rather include multiple queries in one report. The other questions relating to this on SO seem to be related to tables, but I am mainly concerned with just queries.
I have looked at several solutions so far, none of which seem to help:
1) DLookup - returns one value. I need to populate a report with many values from each query.
2) Subreports - I have tried to create text boxes to link my query data, but since they are unbound, it won't let me.
3) Yelling at it. I keep yelling at Access and it doesn't seem to help.
4) One giant query to get the values from all the smaller queries - it doesn't recognize the expressions I built in the smaller queries. Example: CustomerCount = DCount("[Customer_ID]","[Customers]"). Error: 'CustomerCount' is unrecognized.
Any ideas would be greatly appreciated.
Thanks,
If you are creating a report from one query that is made up of multiple subqueries, you can do this by populating textboxes. If looking at the properties on the report > Data tab > Control Source, you would place the name of the your subquery from your giant query and then the value you that you want.
For example:
Master query
SELECT
[Deb<30].CountOfACCT_ID, [Deb<30].SumOfB001,
[Deb<60].CountOfACCT_ID, [Deb<60].SumOfB001,
[Deb<90].CountOfACCT_ID, [Deb<90].SumOfB001,
[Deb>90].CountOfACCT_ID, [Deb>90].SumOfB001,
TodaysHD.CountOfACCT_ID, TodaysHD.SumOfB001,
TodaysLD.CountOfACCT_ID, TodaysLD.SumOfB001,
Part.CountOfACCT_ID, Part.SumOfB001,
FROM [Deb<30], [Deb<60], [Deb<90], [Deb>90], TodaysHD, TodaysLD, Part;
Each of the items in the FROM portion are subqueries being pulled into the master query. Then in your report you would populate the Control Source with [Deb<30].CountOfACCT_ID or whatever value you need from the master query. I have this setup in multiple reports in my application so it should work.
as for 2) you should be able to bind your controls, your subreport should have a record-source.
Else, try listboxes, their graphical apperance isn't exactly flexible, but they might get the job done.
regards,
//t

How to look up values from a table in Access

I have an Access database that is used to store basic info in a table such as first and last name. How would I go about adding the functionality to lookup by last name?
Is there a way to type in the last name and then hit like F12 or something like this? Can someone please point me in the right direction or provide me a link?
SELECT tblPatient.LName AS [Last], tblPatient.FName AS [First]
FROM tblPatient
WHERE (((tblPatient.LName)=[Enter Last Name]));
How do I tie this into my form now?
I'd suggest you create a form, with a textbox 'search' at the top, then either a listbox or subform below to display results.
The listbox record source would be:
SELECT tblPatient.LName, tblPatient.FName
FROM tblPatient
WHERE tblPatient.LName LIKE Forms!myForm!search & '*';
You can either add a Search button, which requeries the listbox, or do the requery via the Change event of the search textbox. The later may be slow if you have a large number of records; if that's the case, you could check that at least 3 (?) characters have been entered before calling the requery.
You just need to create a query in which you put =[?] as the "last name" value.
When you open that view, you'll be asked to type in a lookup value for that field.
Not sure if this is what you are trying to archieve, though...
This is probably a bit overkill for what you want to do, but I assume that you want to perform a search by last name. You should be able to glean the information you need from this article:
Build a search criteria form
http://www.everythingaccess.com/tutorials.asp?ID=Build-a-search-criteria-form
You can create queries in Access if the user you're targeting with the searchability has Access themselves.
From the main Access UI (assuming Access 2007), go to the Create tab and then select the "Query Wizard." Here is an article on the subject.
Otherwise you can create a program and connect to the MDB/ACCDB file running the query programmatically.
Seeing you wish to look up a name and populate the form based on the name selected, I suggest you need a combobox. There is even a wizard for doing exactly what you want. To start, you will need a form bound to a table or query, that is a form with a Record Source.
Add a combobox to your form
Select :
Find a record on my form based on the value I select in my combobox
Select the ID (primary key), Last and First name fields.
Access will display an example, suggesting that you hide the Key (id) column. Accept this.
Choose a name and finish.
There are a few other small things that could be done for neatness, but you will end up with a form that find the record you want. In addition, the combo will autocomplete if you type in a few letter.
If this is an mde, which your subsequent post seems to suggest it is, there is little you can do wuth out the original file. However, you could try opening the database while keeping the shift key held down and see if that allows you to edit. If you cannot get the original and the shift does not work, you could try rescuing the data, if it, too, is stored in this file.