I don't quite understand what is the problem. Can't you put the code you posted into a CommandButton.Click() Event?
>hi,
>thank you,
>
>i useto write mycode as under to see myreport at screen or to print via spical form,
>but i need to do this via myform ,when i can see mydata via mygrid,and print it via command button.
>
>locate for UPPER(inname) = UPPER(TRIM(thisform.pageframe1.page1.text1.Value)) and nam1 = thisform.pageframe1.page1.text4.Value and datein>=thisform.pageframe1.page1.text3.value .and. datein<=thisform.pageframe1.page1.text5.value
>if found()
> set filter to UPPER(inname) = UPPER(TRIM
> (thisform.pageframe1.page1.text1.Value))
> and nam1 =thisform.pageframe1.page1.text4.Value and
> datein>=thisform.pageframe1.page1.text3.value .and.
> datein<=thisform.pageframe1.page1.text5.value
>
> report form mstr22 preview
>else
> =messagebox("not found")
>endif
>
>
>
>thanks.
>best regards
>m.qasem
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)