Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Vijayendran
  Where is Vijayendran?
 Chennai
 India
 Vijayendran
 To: Alan Robson
  Where is Alan Robson?
 newcastle-upon-tyne
 United Kingdom
 Alan Robson
 Tags
Subject: RE: Form
Thread ID: 22199 Message ID: 22404 # Views: 8 # Ratings: 0
Version: Visual FoxPro 5 Category: Forms
Date: Thursday, April 17, 2003 10:45:24 AM         
   


To Alan Robson

Thanks a lot sir. I had made mistake by giving the recordsourcetype as 3 instead of 4 & had also forgotten to give cursorname.fieldname within quotes. My grid is workin fine now. Thnx again.

Regards
Vijayendran S
>
> You seem to be trying to make things much more difficult than they need to be !
> I assume that what you are trying to do is produce a read-only list in a grid when the user clicks on an item in a combo box ?
>
> Try replacing your code with the code I have modified.
> You may also want to set the column count to 9 and put captions in the headers. You may also want to handle the initial state e.g. fill the grid with the details of the first rec in conbo ?
>
> Hope this helps
>
> Alan Robson
>
>
>
> IF MSOTYPE = 'MS'
>
> MSELE = " SELECT vendmast.vcode, Purorder.pono, Purorder.input, Purorder.instage, Purorder.output, Purorder.outstage, Purorder.poqty, Purorder.recdqty, Purorder.rejqty"
> MSELE = MSELE + " Purorder.poqty - Purorder.mosissue + Purorder.rejqty AS BALQTY FROM gears!vendmast INNER JOIN gears!purorder"
> MSELE = MSELE + " ON Vendmast.vcode = Purorder.vcode WHERE Release = 'Y' and Purorder.vcode = mvcode and vendmast.vtype = 'M' INTO CURSOR potab"
>
> *Create the potab cursor here by executing the above SQL
> &MSELE
>
> *No need to set a record source...
> * THISFORM.PAGEFRAME1.PAGE1.GRID1.RECORDSOURCE = msele
>
> *...or a record source type. Incidentally,RECORDSOURCETYPE = 3 sets it to a .QPR file not SQL
> * THISFORM.PAGEFRAME1.PAGE1.GRID1.RECORDSOURCETYPE = 3
>
> * You need quotes around field refs
> WITH THISFORM
> .Pageframe1.Page1.Grid1.Column1.controlsource = "potab.pono"
> .Pageframe1.Page1.Grid1.Column2.controlsource = "potab.Input"
> .Pageframe1.Page1.Grid1.Column3.controlsource = "potab.Instage"
> .Pageframe1.Page1.Grid1.Column4.controlsource = "potab.Output"
> .Pageframe1.Page1.Grid1.Column5.controlsource = "potab.Outstage"
> .Pageframe1.Page1.Grid1.Column6.controlsource = "potab.poqty"
> .Pageframe1.Page1.Grid1.Column7.controlsource = "potab.recdqty"
> .Pageframe1.Page1.Grid1.Column8.controlsource = "potab.rejqty"
> .Pageframe1.Page1.Grid1.Column9.controlsource = "potab.Balqty"
> ENDWITH
>
> ELSE
> ENDIF
>
>
> > To Alan Robson
> >
> > I write the code in the click event of the combo box. I write the following code in the click event of the combo box:
> >
> > MVCODE = VENDMAST.VCODE
> >
> > WITH THISFORM
> > .OVADD.VALUE = VENDMAST.VADD
> > ENDWITH
> >
> > WITH THISFORM
> > .PAGEFRAME1.ENABLED = .T.
> > .PAGEFRAME1.PAGE1.ENABLED = .T.
>
>
> > .PAGEFRAME1.PAGE1.GRID1.ENABLED = .T.
> > .PAGEFRAME1.PAGE1.CMDOK.ENABLED = .T.
> > .PAGEFRAME1.PAGE2.ENABLED = .T.
> > .PAGEFRAME1.PAGE3.ENABLED = .T.
> > ENDWITH
> >
> >
> > LOCAL MSELE
> > MSELE = ''
> >
> > IF MSOTYPE = 'MS'
> >
> > MSELE = " SELECT vendmast.vcode, Purorder.pono, Purorder.input, Purorder.instage, Purorder.output, Purorder.outstage, Purorder.poqty, Purorder.recdqty, Purorder.rejqty"
> > MSELE = MSELE + " Purorder.poqty - Purorder.mosissue + Purorder.rejqty AS BALQTY FROM gears!vendmast INNER JOIN gears!purorder"
> > MSELE = MSELE + " ON Vendmast.vcode = Purorder.vcode WHERE Release = 'Y' and Purorder.vcode = mvcode and vendmast.vtype = 'M' INTO CURSOR potab"
> >
> > THISFORM.PAGEFRAME1.PAGE1.GRID1.RECORDSOURCE = msele
> > THISFORM.PAGEFRAME1.PAGE1.GRID1.RECORDSOURCETYPE = 3
> >
> > WITH THISFORM
> > .Pageframe1.Page1.Grid1.Column1.controlsource = potab.pono
> > .Pageframe1.Page1.Grid1.Column2.controlsource = potab.Input
> > .Pageframe1.Page1.Grid1.Column3.controlsource = potab.Instage
> > .Pageframe1.Page1.Grid1.Column4.controlsource = potab.Output
> > .Pageframe1.Page1.Grid1.Column5.controlsource = potab.Outstage
> > .Pageframe1.Page1.Grid1.Column6.controlsource = potab.poqty
> > .Pageframe1.Page1.Grid1.Column7.controlsource = potab.recdqty
> > .Pageframe1.Page1.Grid1.Column8.controlsource = potab.rejqty
> > .Pageframe1.Page1.Grid1.Column9.controlsource = potab.Balqty
> > ENDWITH
> >
> > ELSE
> > ENDIF
> >
> > Here mvcode is the variable provided through the builder for the combo.
> >
> > Regards
> > Vijayendran S
> >
> > > Where and how are you assigning the values to the grid columns ?
> > >
> > > Alan Robson
> > >
> > > > Respected craiq Moore
> > > >
> > > > As you have mentioned i have used sql statement with a vaiable names "msele" which i asign to the rowsource of the grid. I have also put the sql stat into a cursor named "potab". When i asign the value for the columns in the grid as "potab.column_name" , i get an error saying "potab alias not found".
> > > >
> > > > I have checked where i have given alias & i have not given. I have also checked if i have given "rowsource type as 3" which i have given. I checked for loss of records, but i have plenty of records in the tables i have selected. Can you plz me immediately.
> > > >
> > > > Regards
> > > > Vijenyendran
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > > It depends, is the grid just to view data or do you need to edit it, if it is just for viewing data then I would use an sql statement as the control source for the grid this way you can use the where clause to filter the data, if you need to change, add and update data then I would probably use an updatable view again using a parameter to filter the data.
> > > > >
> > > > > >
> > > > > > I have a form with two option buttons - one button for "MOS VENDOR" and another for "OE VENDOR" . Onclick of "MOS VENDOR" option button the combo box should be filtered based on the type of vendor. From the filtered combo the data in the grid has to be filtered in accordance to the type of vendor. Can anyone help me.
> > > > > >
> > > > > > Regards
> > > > > > Vijayendran S
> > > >
> > > >
> > > > Vijayendran S
> >
> >
> > Vijayendran S


Vijayendran S


COMPLETE THREAD

Form Posted by Vijayendran @ 4/11/2003 1:15:59 PM
RE: Form Posted by Craig Moore @ 4/11/2003 3:36:57 PM
RE: Form Posted by Vijayendran @ 4/15/2003 12:25:56 PM
RE: Form Posted by Alan Robson @ 4/15/2003 1:58:34 PM
RE: Form Posted by Vijayendran @ 4/16/2003 5:06:06 AM
RE: Form Posted by Alan Robson @ 4/17/2003 10:19:29 AM
RE: Form Posted by Vijayendran @ 4/17/2003 10:45:24 AM