My queries are not showing any records that contain one or more blank fields.
I have a table (named DrugInfo) with 35 fields. I want to find records based upon user input for up to five of these fields. These fields are: drug, rph, requester, question summary, question response.
I created a form (named search) with text boxes for these 5 fields to allow the user to input a value into one or more of these fields. The default value for these fields is "". On this form, under properties, I have named the text boxes: qdrug1, qrph1, qrequester1, qqeustion1, qresponse1.
In a query (named Select) on my DrugInfo table,I want to take the one or more criteria that were entered on the form and return all records that match. The problem is that of the 35 fields in the database, there can be one or more that have been left blank. This results in an incomplete display of data. The criteria for the first field(drug) is:
Like nz([Forms]![search].[qdrug1] & "*")
the other 4 criteria follow the format of: Like Nz("*" & [Forms]![search].[qxxx1] & "*")
I have tried to play around with the NZ command, but I cannot get it to return all records that match the requested text and may have one or more of the fields left blank.
I have not used Access very much so please pardon my question on what is probably an rudimentary task, but I have spent hours on this without success. Thanks.
John
I have a table (named DrugInfo) with 35 fields. I want to find records based upon user input for up to five of these fields. These fields are: drug, rph, requester, question summary, question response.
I created a form (named search) with text boxes for these 5 fields to allow the user to input a value into one or more of these fields. The default value for these fields is "". On this form, under properties, I have named the text boxes: qdrug1, qrph1, qrequester1, qqeustion1, qresponse1.
In a query (named Select) on my DrugInfo table,I want to take the one or more criteria that were entered on the form and return all records that match. The problem is that of the 35 fields in the database, there can be one or more that have been left blank. This results in an incomplete display of data. The criteria for the first field(drug) is:
Like nz([Forms]![search].[qdrug1] & "*")
the other 4 criteria follow the format of: Like Nz("*" & [Forms]![search].[qxxx1] & "*")
I have tried to play around with the NZ command, but I cannot get it to return all records that match the requested text and may have one or more of the fields left blank.
I have not used Access very much so please pardon my question on what is probably an rudimentary task, but I have spent hours on this without success. Thanks.
John