Hello,
I am very new to access and am self taught so thank you for your patients.
I have developed a search box in a preexisting database. I am using an "alike" query to make the searching easier. The issue is that some of the fields are not required (so they are often left blank) but I still want them to be searchable. When I put the alike query for these non required fields, only data that has values is returned, even if the search box for that field is blank.
I am using:
ALike "%" & [Forms]![frmSearch]![frmSearch1].[Form]![txtLastName] & "%"
For example, the first name is not required but the last name is. There are several records where the first name is left blank. So if I put the alike statement in the first and last name Criteria section in the query, and I search for the last name "Johnson" only record 2 will be a result. If I put the alike statement only for the last name, both record 1 and 2 will be the result. But the problem is I cannot search by first name.
Example table:
Record First Name Last Name
1 Johnson
2 Robert Johnson
Any help would be appreciated.
I am very new to access and am self taught so thank you for your patients.
I have developed a search box in a preexisting database. I am using an "alike" query to make the searching easier. The issue is that some of the fields are not required (so they are often left blank) but I still want them to be searchable. When I put the alike query for these non required fields, only data that has values is returned, even if the search box for that field is blank.
I am using:
ALike "%" & [Forms]![frmSearch]![frmSearch1].[Form]![txtLastName] & "%"
For example, the first name is not required but the last name is. There are several records where the first name is left blank. So if I put the alike statement in the first and last name Criteria section in the query, and I search for the last name "Johnson" only record 2 will be a result. If I put the alike statement only for the last name, both record 1 and 2 will be the result. But the problem is I cannot search by first name.
Example table:
Record First Name Last Name
1 Johnson
2 Robert Johnson
Any help would be appreciated.