Macro comparison, why is one not working??

TDC21

Board Regular
Joined
Mar 31, 2017
Messages
97
I have 2 search forms, one is working just fine, I used it as a template to build the second but something is different and Im not seeing it. Both forms are using an Apply filter macro on a "search" command that references 3 test boxes

Working Marco - Apply Filter - Where

([SEARCH_MTR]![MTR] Like "*" & [Forms]![SEARCH_MTR]![Search-MTR] & "*") And
([SEARCH_MTR]![HEAT/SLAB] Like "*" & [Forms]![SEARCH_MTR]![Search-HS] & "*") And
([SEARCH_MTR]![THICK] Like "*" & [Forms]![SEARCH_MTR]![Search-THICK] & "*")

Failed Macro - Apply Filter - Where

([SEARCH_INV]![MTR] Like "*" & [Forms]![SEARCH_INV]![Search_MTR] & "*") And
([SEARCH_INV]![HEAT/SLAB] Like "*" & [Forms]![SEARCH_INV]![Search_HS] & "*") And
([SEARCH_INV]![THICK] Like "*" & [Forms]![SEARCH_INV]![Search_Thick] & "*")

When I open the working Form I receive a enter parameter prompt, I can bypass it and all data will show. I can use any of the search boxes and the form returns the correct results, it will show a single prompt to enter additional data but clicking ok and bypassing it returns the correct results enven when only one text box has a value.

When I open the failing Form I receive no prompts, it opens but if I use any of the text filters I receive 3 prompts to enter data, one for each text field. If I enter data in the text boxes and bypass the prompts no data is shown, if I enter data into one or two of the prompts no data is shown, if I enter data into all three of the prompts all data shows with matched entries sorted first.

I don't understand why they are preforming so differently, any thoughts on what might be going wrong here?
 
It looks okay to me. You could remove one of the nz() functions, then the other, to test if both work separately and at the same time be less than 255 characters. If so, you'll be in a pickle and would probably have to rename the query or the textboxes to be shorter names. Or use VBA instead of a macro.
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,214,524
Messages
6,120,049
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top