Perry, you said in one of your messages with Edward that you were using a Trim() function. If your variable gcDeptNo is blank, then your clause becomes
WHERE ass_1_dept = ''
In this case you will get ALL the departments. Check the values of the variables immediately before the SQL is run - show them on the screen, in a wait window, etc. If they ARE empty, then they are being re-set in code. You could be reassigning them as LOCAL or PRIVATE variables, etc.
HTH
Barbara
>I have an SQL statement where I'm using global variables as filters. When execute the select, it doesn't seem to recognize the values of the variables and does a general select.
>
>Ex:
>
>SELECT ass_l_ata,s_or_type FROM temp ;
>INTO CURSOR cleared ;
>WHERE s_status = 'Cleared' AND ass_l_dept = gcDeptNo ;
>AND mnemonic = gcProject AND ass_l_grp = gcGroup ;
>ORDER BY ass_l_ata
>
>SELECT ass_l_ata,s_or_type FROM temp ;
>INTO CURSOR outstanding ;
>WHERE ass_l_dept = gcDeptNo ;
>AND mnemonic = gcProject AND ass_l_grp = gcGroup ;
>AND NOT s_status = 'Cleared' ;
>ORDER BY ass_l_ata
>
>VFP doesn't seem to recognize the values of the variables.
>
>Perry