Hello - I have the following problem that I'm hoping someone can help me with.
I have a form that has 3 list boxes as search fields. They are account #, policy # and name. When one of the search fields is filled in and <enter> is pressed it populates the subform below which shows the corresponding records. All 3 search fields were working find until I realized I needed to give the user the ability to enter part of the "name" field and pull up all records with that part. (ie. user enters "RAIN" presses <enter> and the following records come up - Mark Rains, Rainbow Store, Mike Rainer.). I changed the code in the query to allow the user to do this and it worked great. The problem is that after I added this code - the account# and policy # search functions no longer work. If I enter a valid policy # and press <enter> nothing happens. However, if I leave that valid policy # there and also enter a name in the name search field and press <enter> it brings up the appropriate records for the name field AND the record with the corresponding policy # I entered above. Here's the code I have in my query to allow the search to work:
((Mid([mastersearch]![policyno],1,10))=[Forms]![SEARCH2]![combo2]) Or (([mastersearch].[name]) Like "*" & [Forms]![SEARCH2]![combo14] & "*") Or (([mastersearch].[ACCTNO])=[Forms]![SEARCH2]![combo12])
Does anyone have any ideas about what the problem is and how I can fix it?
Thanks in advance for any help!
Caitlin
I have a form that has 3 list boxes as search fields. They are account #, policy # and name. When one of the search fields is filled in and <enter> is pressed it populates the subform below which shows the corresponding records. All 3 search fields were working find until I realized I needed to give the user the ability to enter part of the "name" field and pull up all records with that part. (ie. user enters "RAIN" presses <enter> and the following records come up - Mark Rains, Rainbow Store, Mike Rainer.). I changed the code in the query to allow the user to do this and it worked great. The problem is that after I added this code - the account# and policy # search functions no longer work. If I enter a valid policy # and press <enter> nothing happens. However, if I leave that valid policy # there and also enter a name in the name search field and press <enter> it brings up the appropriate records for the name field AND the record with the corresponding policy # I entered above. Here's the code I have in my query to allow the search to work:
((Mid([mastersearch]![policyno],1,10))=[Forms]![SEARCH2]![combo2]) Or (([mastersearch].[name]) Like "*" & [Forms]![SEARCH2]![combo14] & "*") Or (([mastersearch].[ACCTNO])=[Forms]![SEARCH2]![combo12])
Does anyone have any ideas about what the problem is and how I can fix it?
Thanks in advance for any help!
Caitlin