Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A parameterized view as a grid recordsource 1

Status
Not open for further replies.

trimtrom

Programmer
Dec 12, 2003
35
0
0
GB
Hello,

I am a beginner Foxpro 6 programmer, and I have a problem with parameterized views.

I am trying to use a view as the recordsource for a grid (on a pageframe). By changing the parameter of the view, I want to change the data in the grid, and I have written the following code in the click event of the page frame.
Code:
local paraid
paraid = thisform.pfdbtr.page1.txtid.value
thisform.pfdbtr.page2.grid1.recordsource = ""
thisform.pfdbtr.page2.grid1.recordsource = "vwslaccount"
thisform.refresh
thisform.pfdbtr.page2.grid1.refresh()

By changing the parameter paraid, I hope to change the data of the view in the grid.

However , in practice the view shows an input box to get the first parameter when the form opens, and thereafter refuses to refresh and change the data at all, although paraid has changed. Help!!

Code snippets appreciated.

Thanks,Trimtrom
 
Hi Trimtrom,
Did you try to requery after changing your parameter ?
=requery("vwslaccount")
This should be done every time you are changing your paremeter of the parametrized view.
I would suggest to requery in the valid method of thisform.pfdbtr.page1.txtid

However , in practice the view shows an input box to get the first parameter when the form opens, and thereafter refuses to refresh and change the data at all, although paraid has changed.
Try to open the view with nodataonload. Than somewhere in the initmethod of the form :
paraid = thisform.pfdbtr.page1.txtid.value
thisform.pfdbtr.page2.grid1.recordsource = "vwslaccount"
thisform.refresh

-Bart
 
Thanks - it was the requery command that I needed. All is now working.

Trimtrom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top