Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Hi Gregory
Thanks for the tip, it worked well. I'm glad you decided to suggestit. Thanks again.
Regards,
Carmen
>>Hello All
>> I am currently setting up a filter in a table. The syntax for the filter command is as follows:
>> set filter to !ps_printed .and. ordno >= thisform.combo1.value .and. ordno <= thisform.combo2.value
>> I am filtering within a range of orders that the user would like to print, and I am only printed those where a packing slip has not yet been printed. The filter seems to be logical enough, and I can achieve the correct results when I issue the command in the command window. When I run the form, I get the following error "Object is not contained in a form". Needless to say, I am not able to debug this. I cannot seem to find where the error is, but the debugger does point to the browse command. I put the browse command in just to check to see if the data is being filtered properly, it (browse) will not be in the final application. Any thoughts?
>>
>>
>>Regards,
>>Carmen
>
>Carmen,
>
>Just to add to the others
>
>Never use variables directly in filter expressions. If you browse through (or move the record pointer in) the table, the Filter() is re-evaluated and hence the variables are accessed (like with thisform)
>
>If you need to use variables, use macro expressions
>
>eg (1) char fields
>
>namefrom = 'ca'
>nameto = 'da'
>
>local f
>f = [between(nameField, '] + namefrom + [', '] + nameto + [')]
>?f
>set filter to &f
>
>eg (2) num fields
>
>orderfrom = 33
>orderto = 99
>
>f = [between(ordno, ] + str(orderfrom) + [,] + str(orderto) + [)]
>?f
>set filter to &f
>
>iow, create a char expression that contains exactly the filter as if you would type it if you knew the values
>
>That way, once the filter is set, it contains no reference to the initial variable which (a) may not exist any more by then or (b) cannot be referenced like with the this/thisform scenario
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement