Re: Searching on multiple fields
Posted: Fri Apr 23, 2021 5:01 pm
Im sorry I dont' understand the acronyms, HK, PK??? I think I'm over thinking this. In a Previous post I asked how to prevent a Forms auto search function from auto-firing when I first open the form. Right Now if I open that TaxCustomer Form by itself, it goes to the Search screen as shown above, but it doesn't auto retrieve any results. That's what I wanted it to do. I have to enter a value in the search and either click the search button or the searchEncrypted button. It works great this way.
How then do I make this form auto fire the search function? How do I turn it back on? Where does it get the SQL for the auto search function?
With that in mind couldn't I call this same form, from a launch form where I set the #FRM_search# and #FRM_lastname# variables and then have the form run the auto firing search using the #FRM_lastname# variable in its SQL statement that it uses when it auto runs? Then that would retrieve the records and list them normally, Right? Ijust now have to figure out how I turned off that auto-search and where it gets the SQL to run? And can I pas the FRM_lastname variable to that SQL?
I tried add this to the BB:
But it didn't work. I didn't see any results. I looked at my Debug and I see that the variable are being passed through ok from my launch form but no results were listed, So Im wondering if the natural function of the from somehow ignored those results or stopped it from running.
How then do I make this form auto fire the search function? How do I turn it back on? Where does it get the SQL for the auto search function?
With that in mind couldn't I call this same form, from a launch form where I set the #FRM_search# and #FRM_lastname# variables and then have the form run the auto firing search using the #FRM_lastname# variable in its SQL statement that it uses when it auto runs? Then that would retrieve the records and list them normally, Right? Ijust now have to figure out how I turned off that auto-search and where it gets the SQL to run? And can I pas the FRM_lastname variable to that SQL?
I tried add this to the BB:
Code: Select all
if ("#FRM_search#" == false) {
nuDebug("NOT Called by SearchForm");
} else {
$s = "
SELECT TaxCustomers.* FROM TaxCustomers";
nuDebug("Call by SearchForm = #FRM_lastname#");
if ("#FRM_lastname#" != "") {$s = $s." WHERE (TaxCustomers.cust_lastname LIKE '#FRM_lastname#%')";}
$s = $s." ORDER BY cust_lastname";
nuDebug("SQL=".$s);
//This runs the SQL query against my table to retrieve the data I need.
$t = nuRunQuery($s);
} // end if FRM_Search