Hi all,
I'm not very conversant with the vocabulary of Access, so please ask for clarification if necessary...
I am trying to build a search form that allows combinations of search terms. For example, let's say I have three controls on my form; year, keyword, location. Entering a valid value for all three gives expected results from the dataset. However, I'd like to interpret a blank field in the search form as ignoring that constraint. The user should be able to enter values into any combination of form fields, e.g., entering only a year returns all records associated with that year, irrespective of any values in the other two fields. Entering a value in one of the other two fields refines the search result.
I've seen forms like this one:
http://www.mvps.org/access/forms/frm0045.htm
This looks like a great utility, but I can't get it to work in my db... launching the form populates the list of objects control, but clicking any button or object name yields a 'Variable not defined' error. I don't know enough about VB/A to troubleshoot this.
Other solutions I've seen around look very close, but require more understanding of the scripts than I have currently. Here is the query I'm starting with:
Clearly this is a simple Logical AND setup, so I understand it requires a value to search on for each criterion. Not entering a value is interpreted literally - the query is looking for null values in the field.
So, I'm wondering 1) if there's something relatively simple I'm missing in setting up the query to interpret no value as meaning 'ignore this parameter', 2) is my approach all wrong, 3) does anyone know of a way to get the linked form to work, or of a competing utility that will provide similar functionality.
I do some scripting in other languages, but have precious little experience w/ VB. I'm willing to do some homework here, but I've got lots of other irons in the fire, and don't want to take a couple of courses to solve this issue. Having said that, I do appreciate any insights even if they include 'take a class' :)
Thanks!
-Scott
I'm not very conversant with the vocabulary of Access, so please ask for clarification if necessary...
I am trying to build a search form that allows combinations of search terms. For example, let's say I have three controls on my form; year, keyword, location. Entering a valid value for all three gives expected results from the dataset. However, I'd like to interpret a blank field in the search form as ignoring that constraint. The user should be able to enter values into any combination of form fields, e.g., entering only a year returns all records associated with that year, irrespective of any values in the other two fields. Entering a value in one of the other two fields refines the search result.
I've seen forms like this one:
http://www.mvps.org/access/forms/frm0045.htm
This looks like a great utility, but I can't get it to work in my db... launching the form populates the list of objects control, but clicking any button or object name yields a 'Variable not defined' error. I don't know enough about VB/A to troubleshoot this.
Other solutions I've seen around look very close, but require more understanding of the scripts than I have currently. Here is the query I'm starting with:
Code:
SELECT tblCards01.serialNumber, tblCards01.barcode, tblCards01.cardTitle, tblCards01.cardKeywords, tblCards01.cardYear, tblCards01.locCity, tblCards01.locState, tblCards01.cardStory, tblCards01.luOrientation, tblCards01.luDimensions FROM tblCards01 WHERE (((tblCards01.cardKeywords) Like "*" & Forms!frmQryKeyword!qryKeyword & "*") And ((tblCards01.luOrientation)=(Forms!frmQryKeyword!qryOrientation)) And ((tblCards01.cardYear)=(Forms!frmQryKeyword!qryYear)));
So, I'm wondering 1) if there's something relatively simple I'm missing in setting up the query to interpret no value as meaning 'ignore this parameter', 2) is my approach all wrong, 3) does anyone know of a way to get the linked form to work, or of a competing utility that will provide similar functionality.
I do some scripting in other languages, but have precious little experience w/ VB. I'm willing to do some homework here, but I've got lots of other irons in the fire, and don't want to take a couple of courses to solve this issue. Having said that, I do appreciate any insights even if they include 'take a class' :)
Thanks!
-Scott
Comment