Re: Form designer rules?
You're forgiven. On Wed, May 26, 2021 at 5:13 PM Tracy Pearson wrote: > I admit, I prefer to not use the UI controls that way. > I also admit that I'm an enabler, and if people want to use the controls > that way I help. > I should probably start adding something like: You could do it that way, > though it may not be as maintainable if you did X. > > Tracy > > -Original Message- > From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Alan > Bourke > Sent: Wednesday, May 26, 2021 8:42 AM > To: profoxt...@leafe.com > Subject: Re: Form designer rules? > > On Mon, 24 May 2021, at 3:54 PM, Eric Selje wrote: > > > I know you're all probably tired of hearing this drumbeat, but having SQL > > statements in UI controls is a bad idea. Do what you can to separate that > > out. > > I agree. > [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/CAPqLOBwWZEBPvs6A1FsO=SNVkUkrsV91O=yqfjzmjovhr6+...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
RE: Form designer rules?
I admit, I prefer to not use the UI controls that way. I also admit that I'm an enabler, and if people want to use the controls that way I help. I should probably start adding something like: You could do it that way, though it may not be as maintainable if you did X. Tracy -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Alan Bourke Sent: Wednesday, May 26, 2021 8:42 AM To: profoxt...@leafe.com Subject: Re: Form designer rules? On Mon, 24 May 2021, at 3:54 PM, Eric Selje wrote: > I know you're all probably tired of hearing this drumbeat, but having SQL > statements in UI controls is a bad idea. Do what you can to separate that > out. I agree. [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/000301d75241$8b42ed50$a1c8c7f0$@powerchurch.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Form designer rules?
On Mon, 24 May 2021, at 3:54 PM, Eric Selje wrote: > I know you're all probably tired of hearing this drumbeat, but having SQL > statements in UI controls is a bad idea. Do what you can to separate that > out. I agree. ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/24b7400d-109b-470b-8ece-451144d8b...@www.fastmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Form designer rules?
I know you're all probably tired of hearing this drumbeat, but having SQL statements in UI controls is a bad idea. Do what you can to separate that out. Eric On Sun, May 23, 2021 at 11:07 PM Tracy Pearson wrote: > Combobox1 selects into a cursor. Use that cursor name in the where clause > of the select statement in combobox2. > In the valid event of combobox1, call the requery method of combobox2. > The initial queries are processed after the form load event. They only > requery when told to. > > HTH > Tracy > > On May 23, 2021 11:26:11 PM EDT, Joe Yoder wrote: > >My data is in a table called labels with three fields, space, location, > >and > >label. > >I thought my problems were solved but now when I setup my second combo > >box > >with the row source set to > > > >select location distinct from labels where labels.space = > >thisform.combo1.value = labels.space into cursor T2 > >I get the message "Thisform can only be used within a method" > > > >When I set the row source to > > > >select location distinct from labels where labels.space =combo1.value > >= > >labels.space into cursor T2 > >I get the message "Ali8as Combo1 is not found." > > > >When I put the SQL code in the load or init methods of the form it > >works > >without error so the code is okay > >Is there a different syntax needed here or do I need to handle this in > >a > >different way? > > > >Thanks, > > > >Joe > > > >On Sun, May 23, 2021 at 7:23 PM Joe Yoder wrote: > > > >> Tracy, > >> > >> I did another test form using days of the week like yours. I still > >got > >> the error. Then I removed the quotes around the CSL statement and it > >> worked! Somewhere in my surfing I had read that the quotes were > >required > >> but that is apparently incorrect. > >> > >> More details: > >> > >>1. When does the SQL get executed? When it is first loaded? Each > >>time the control gets focus? When requiry is called? > >>2. Are all cursors created this way in scope for the entire VFP > >system? > >>3. Is there a simple way to see the VFP code generated by the Form > >>Designer to understand how it works? > >> > >> Thanks so much, > >> > >> Joe > >> > >> On Sun, May 23, 2021 at 11:41 AM Tracy Pearson > > > >> wrote: > >> > >>> Hi Joe, > >>> > >>> Those settings are working for me in my quick test. > >>> Does the SQL statement you have in the RowSource work in code? > >>> > >>> As a test I built a cursor with the days of the week in it in the > >Load > >>> event > >>> of a form. > >>> CREATE CURSOR ComboBoxData (id i, displaytext c(30)) > >>> I set the ComboBox.RowSource to > >>> select displaytext from comboboxdata into cursor t1 > >>> and set the ComboBox.RowSourceType = 3 && SQL statement > >>> > >>> To be consistent with your select statement I added the "distinct" > >clause > >>> and it still works. > >>> > >>> I tested in VFP 9 SP2 Hotfix 3 > >>> > >>> HTH, > >>> Tracy > >>> > >>> -Original Message- > >>> From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of > >Joe > >>> Yoder > >>> Sent: Saturday, May 22, 2021 3:04 PM > >>> To: profoxt...@leafe.com > >>> Subject: Form designer rules? > >>> > >>> I want to use an sql select statement as the row source for a combo > >box.. > >>> > >>>- When I set the row source type to 3-SQL and enter the row > >source as > >>>"select space distinct from map into cursor T1" attempting to run > >the > >>> form > >>>results in "Program error Unrecognized command verb" > >>>- If I set the row source type to 2-Alias and the row source to > >T1 and > >>>put the SQL select statement into the init method of the control > >the > >>> Combo > >>>box populates properly. > >>> > >>> I would have expected that the system would be smart enough to run > >the SQl > >>> statement before trying to use it's output. Is there something else > >I > >>> need > >>> to call perhaps in the form init method? > >>> > >>> Thanks in advance, > >>> > >>> Joe > >>> > >>> > >>> --- StripMime Report -- processed MIME parts --- > >>> multipart/alternative > >>> text/plain (text body -- kept) > >>> text/html > >>> --- > >>> [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/caawxvukn0itq3v7rs0hka4zlqvhoj2d9k5i1606rdo18fjw...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Form designer rules?
Combobox1 selects into a cursor. Use that cursor name in the where clause of the select statement in combobox2. In the valid event of combobox1, call the requery method of combobox2. The initial queries are processed after the form load event. They only requery when told to. HTH Tracy On May 23, 2021 11:26:11 PM EDT, Joe Yoder wrote: >My data is in a table called labels with three fields, space, location, >and >label. >I thought my problems were solved but now when I setup my second combo >box >with the row source set to > >select location distinct from labels where labels.space = >thisform.combo1.value = labels.space into cursor T2 >I get the message "Thisform can only be used within a method" > >When I set the row source to > >select location distinct from labels where labels.space =combo1.value >= >labels.space into cursor T2 >I get the message "Ali8as Combo1 is not found." > >When I put the SQL code in the load or init methods of the form it >works >without error so the code is okay >Is there a different syntax needed here or do I need to handle this in >a >different way? > >Thanks, > >Joe > >On Sun, May 23, 2021 at 7:23 PM Joe Yoder wrote: > >> Tracy, >> >> I did another test form using days of the week like yours. I still >got >> the error. Then I removed the quotes around the CSL statement and it >> worked! Somewhere in my surfing I had read that the quotes were >required >> but that is apparently incorrect. >> >> More details: >> >>1. When does the SQL get executed? When it is first loaded? Each >>time the control gets focus? When requiry is called? >>2. Are all cursors created this way in scope for the entire VFP >system? >>3. Is there a simple way to see the VFP code generated by the Form >>Designer to understand how it works? >> >> Thanks so much, >> >> Joe >> >> On Sun, May 23, 2021 at 11:41 AM Tracy Pearson > >> wrote: >> >>> Hi Joe, >>> >>> Those settings are working for me in my quick test. >>> Does the SQL statement you have in the RowSource work in code? >>> >>> As a test I built a cursor with the days of the week in it in the >Load >>> event >>> of a form. >>> CREATE CURSOR ComboBoxData (id i, displaytext c(30)) >>> I set the ComboBox.RowSource to >>> select displaytext from comboboxdata into cursor t1 >>> and set the ComboBox.RowSourceType = 3 && SQL statement >>> >>> To be consistent with your select statement I added the "distinct" >clause >>> and it still works. >>> >>> I tested in VFP 9 SP2 Hotfix 3 >>> >>> HTH, >>> Tracy >>> >>> -Original Message- >>> From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of >Joe >>> Yoder >>> Sent: Saturday, May 22, 2021 3:04 PM >>> To: profoxt...@leafe.com >>> Subject: Form designer rules? >>> >>> I want to use an sql select statement as the row source for a combo >box.. >>> >>>- When I set the row source type to 3-SQL and enter the row >source as >>>"select space distinct from map into cursor T1" attempting to run >the >>> form >>>results in "Program error Unrecognized command verb" >>>- If I set the row source type to 2-Alias and the row source to >T1 and >>>put the SQL select statement into the init method of the control >the >>> Combo >>>box populates properly. >>> >>> I would have expected that the system would be smart enough to run >the SQl >>> statement before trying to use it's output. Is there something else >I >>> need >>> to call perhaps in the form init method? >>> >>> Thanks in advance, >>> >>> Joe >>> >>> >>> --- StripMime Report -- processed MIME parts --- >>> multipart/alternative >>> text/plain (text body -- kept) >>> text/html >>> --- >>> [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/1f1ea044-67b3-4487-9573-71c08d7ba...@powerchurch.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Form designer rules?
My data is in a table called labels with three fields, space, location, and label. I thought my problems were solved but now when I setup my second combo box with the row source set to select location distinct from labels where labels.space = thisform.combo1.value = labels.space into cursor T2 I get the message "Thisform can only be used within a method" When I set the row source to select location distinct from labels where labels.space =combo1.value = labels.space into cursor T2 I get the message "Ali8as Combo1 is not found." When I put the SQL code in the load or init methods of the form it works without error so the code is okay Is there a different syntax needed here or do I need to handle this in a different way? Thanks, Joe On Sun, May 23, 2021 at 7:23 PM Joe Yoder wrote: > Tracy, > > I did another test form using days of the week like yours. I still got > the error. Then I removed the quotes around the CSL statement and it > worked! Somewhere in my surfing I had read that the quotes were required > but that is apparently incorrect. > > More details: > >1. When does the SQL get executed? When it is first loaded? Each >time the control gets focus? When requiry is called? >2. Are all cursors created this way in scope for the entire VFP system? >3. Is there a simple way to see the VFP code generated by the Form >Designer to understand how it works? > > Thanks so much, > > Joe > > On Sun, May 23, 2021 at 11:41 AM Tracy Pearson > wrote: > >> Hi Joe, >> >> Those settings are working for me in my quick test. >> Does the SQL statement you have in the RowSource work in code? >> >> As a test I built a cursor with the days of the week in it in the Load >> event >> of a form. >> CREATE CURSOR ComboBoxData (id i, displaytext c(30)) >> I set the ComboBox.RowSource to >> select displaytext from comboboxdata into cursor t1 >> and set the ComboBox.RowSourceType = 3 && SQL statement >> >> To be consistent with your select statement I added the "distinct" clause >> and it still works. >> >> I tested in VFP 9 SP2 Hotfix 3 >> >> HTH, >> Tracy >> >> -Original Message- >> From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Joe >> Yoder >> Sent: Saturday, May 22, 2021 3:04 PM >> To: profoxt...@leafe.com >> Subject: Form designer rules? >> >> I want to use an sql select statement as the row source for a combo box.. >> >>- When I set the row source type to 3-SQL and enter the row source as >>"select space distinct from map into cursor T1" attempting to run the >> form >>results in "Program error Unrecognized command verb" >>- If I set the row source type to 2-Alias and the row source to T1 and >>put the SQL select statement into the init method of the control the >> Combo >>box populates properly. >> >> I would have expected that the system would be smart enough to run the SQl >> statement before trying to use it's output. Is there something else I >> need >> to call perhaps in the form init method? >> >> Thanks in advance, >> >> Joe >> >> >> --- StripMime Report -- processed MIME parts --- >> multipart/alternative >> text/plain (text body -- kept) >> text/html >> --- >> [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/cabqednupivuyhyfemjn6gdj2o432kq27bbswrzbnytbhtup...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Form designer rules?
Tracy, I did another test form using days of the week like yours. I still got the error. Then I removed the quotes around the CSL statement and it worked! Somewhere in my surfing I had read that the quotes were required but that is apparently incorrect. More details: 1. When does the SQL get executed? When it is first loaded? Each time the control gets focus? When requiry is called? 2. Are all cursors created this way in scope for the entire VFP system? 3. Is there a simple way to see the VFP code generated by the Form Designer to understand how it works? Thanks so much, Joe On Sun, May 23, 2021 at 11:41 AM Tracy Pearson wrote: > Hi Joe, > > Those settings are working for me in my quick test. > Does the SQL statement you have in the RowSource work in code? > > As a test I built a cursor with the days of the week in it in the Load > event > of a form. > CREATE CURSOR ComboBoxData (id i, displaytext c(30)) > I set the ComboBox.RowSource to > select displaytext from comboboxdata into cursor t1 > and set the ComboBox.RowSourceType = 3 && SQL statement > > To be consistent with your select statement I added the "distinct" clause > and it still works. > > I tested in VFP 9 SP2 Hotfix 3 > > HTH, > Tracy > > -Original Message- > From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Joe > Yoder > Sent: Saturday, May 22, 2021 3:04 PM > To: profoxt...@leafe.com > Subject: Form designer rules? > > I want to use an sql select statement as the row source for a combo box.. > >- When I set the row source type to 3-SQL and enter the row source as >"select space distinct from map into cursor T1" attempting to run the > form >results in "Program error Unrecognized command verb" >- If I set the row source type to 2-Alias and the row source to T1 and >put the SQL select statement into the init method of the control the > Combo >box populates properly. > > I would have expected that the system would be smart enough to run the SQl > statement before trying to use it's output. Is there something else I need > to call perhaps in the form init method? > > Thanks in advance, > > Joe > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > text/plain (text body -- kept) > text/html > --- > [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/CABQeDnUFb5E3KoLGgVf0NcCR2JiNG-gv=J6=udqcecx74qk...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Re: Form designer rules?
Hi Joe, don't put in quotes or double quotes the sql statement! Gianni On Sat, 22 May 2021 15:03:50 -0400, Joe Yoder wrote: I want to use an sql select statement as the row source for a combo box.. - When I set the row source type to 3-SQL and enter the row source as "select space distinct from map into cursor T1" attempting to run the form results in "Program error Unrecognized command verb" - If I set the row source type to 2-Alias and the row source to T1 and put the SQL select statement into the init method of the control the Combo box populates properly. I would have expected that the system would be smart enough to run the SQl statement before trying to use it's output. Is there something else I need to call perhaps in the form init method? Thanks in advance, Joe ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/6cmlag9h7fvidqmrfrlmdmgr5mt7ne6...@4ax.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
RE: Form designer rules?
Hi Joe, Those settings are working for me in my quick test. Does the SQL statement you have in the RowSource work in code? As a test I built a cursor with the days of the week in it in the Load event of a form. CREATE CURSOR ComboBoxData (id i, displaytext c(30)) I set the ComboBox.RowSource to select displaytext from comboboxdata into cursor t1 and set the ComboBox.RowSourceType = 3 && SQL statement To be consistent with your select statement I added the "distinct" clause and it still works. I tested in VFP 9 SP2 Hotfix 3 HTH, Tracy -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Joe Yoder Sent: Saturday, May 22, 2021 3:04 PM To: profoxt...@leafe.com Subject: Form designer rules? I want to use an sql select statement as the row source for a combo box.. - When I set the row source type to 3-SQL and enter the row source as "select space distinct from map into cursor T1" attempting to run the form results in "Program error Unrecognized command verb" - If I set the row source type to 2-Alias and the row source to T1 and put the SQL select statement into the init method of the control the Combo box populates properly. I would have expected that the system would be smart enough to run the SQl statement before trying to use it's output. Is there something else I need to call perhaps in the form init method? Thanks in advance, Joe --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- [excessive quoting removed by server] ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/006801d74fea$04077c60$0c167520$@powerchurch.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.