0

Good day,

I created a simple search in sql. inside the textchange event. everythis seem to be ok for text box. i want to have another search with the other text but this time i want to use the first search and concat it with the next condition..

here is the scenario...

once i type in the textbox and press enter all the record with the this character will return..

this is filtered in the first textbox

SELECT 
        MRN
        ,FIRSTNAME
        ,MIDDLENAME
        ,LASTNAME
        ,GENDER
        ,BIRTHDATE 
        ,MARITAL_STATUS

        FROM Patient_Information 

        WHERE 
        FIRSTNAME LIKE @FIRSTNAME+'%'

how could i put the other filter that was will be filtered by other textbox

thanks

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by cyberdaemon
0

You can declare a var to hold your query in the declarations part of your form (before the first sub) and a second one to hold your query criteria. This will give your vars scope for all events in this form and allow you to use them in 2 or more different subs.

When coding the textchanged events instead of declaring a string for your query, use the ones that have scope the entire form. Check if the query_criteria one has a value assigned and if it does concatenate your new criteria at the end (make sure you concatenate a space in there as well). If it doesn't have a value assign it one.

execute your query by concatenating the 2 string vars (the query and the query criteria) for each of the 2 subs.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.