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!

'Field' phrase not found 4

Status
Not open for further replies.

Mandy_crw

Programmer
Jul 23, 2020
578
0
16
PH
Hi everyone.. please help me what im i missing, it keeps on saying field phrase not found... thanks....

ADD OBJECT combo1 AS COMBOBOX WITH ; && Name
RowSourceType = 6, RowSource = "MyDataB",;
Height = 23, ;
Left = 305, ;
Top = 5, ;
Width = 210

PROCEDURE Load

SELECT tsulat.sname,fname,idnum FROM sms ORDER BY tsulat.sname,fname INTO CURSOR MyDataB
SELECT pay.P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 FROM PAYOLA ORDER BY P1 INTO CURSOR MyPayTui
SELECT pay.BACK1, BACK2, BACK3, BACK4, BACK5 FROM PAYOLA ORDER BY BACK1 INTO CURSOR MyPayBack
SELECT pay.BOOK1, BOOK2, BOOK3, BOOK4, BOOK5 FROM PAYOLA ORDER BY BOOK1 INTO CURSOR MyPayBooks
SELECT pay.UNI1, UNI2, UNI3, UNI4, UNI5 FROM PAYOLA ORDER BY UNI1 INTO CURSOR MyPayUNi

ENDPROC

PROCEDURE Init

SET TALK OFF
SET BELL OFF
SET CENTURY ON
SET CONFIRM OFF
SET SAFETY OFF
SET ECHO OFF
SET ESCAPE OFF
SET AUTOSAVE ON

SELECT 2
USE payola EXCLUSIVE ALIAS pay
INDEX ON IDNUM TO IDNUMX

SELECT 1
USE SMS exclusive ALIAS TSULAT
INDEX ON IDNUM TO IDNUMX2

SET RELATION TO IDNUM INTO pay

this.oGrid1.width = 400
this.oGrid1.Column1.Width = 100

this.oGrid1.Column1.Header1.caption = "Name of Student"
this.oGrid1.Column1.Header1.fontname = "Bernard MT Condensed"
*this.oGrid1.Column2.Header1.FontSize = 11
this.oGrid1.Column1.Width = 120

this.oGrid1.Column2.Header1.caption = "ID Number"
this.oGrid1.Column2.Header1.fontname = "Bernard MT Condensed"
*this.oGrid1.Column2.Header1.FontSize = 11
this.oGrid1.Column2.Width = 150

PROCEDURE combo1.click()

SELECT 1

SEEK ALLTRIM(MyDataB.idnum)

IF FOUND()

SELECT 2

this.oGrid2.RecordSource = SPACE(0)

SELECT P1,P2,P3,P4,P5,P6,P7,P8,P9,P10 FROM PAYMENTS WHERE idnum = ALLTRIM(MyDataB.idnum) INTO CURSOR MyPayTui
this.oGrid2.RecordSource = "MyPayTui"

this.oGrid3.RecordSource = SPACE(0)

SELECT BACK1,BACK2,BACK3,BACK4,BACK5 FROM PAYMENTS WHERE idnum = ALLTRIM(MyDataB.idnum) INTO CURSOR MyPayBack
this.oGrid3.RecordSource = "MyPayBack"

this.oGrid4.RecordSource = SPACE(0)

SELECT BOOK1,BOOK2,BOOK3,BOOK4,BOOK5 FROM PAYMENTS WHERE idnum = ALLTRIM(MyDataB.idnum) INTO CURSOR MyPayBooks
this.oGrid4.RecordSource = "MyPayBooks"

this.oGrid5.RecordSource = SPACE(0)

SELECT UNI1,UNI2,UNI3,UNI4,UNI5 FROM PAYMENTS WHERE idnum = ALLTRIM(MyDataB.idnum) INTO CURSOR MyPayUni
this.oGrid5.RecordSource = "MyPayUni"

ENDIF
 
I think we would need to see more details of the error, but

Code:
SELECT tsulat.sname,fname,idnum FROM sms ORDER BY tsulat.sname,fname INTO CURSOR MyDataB

Might need a reference to tsulat

Code:
SELECT tsulat.sname,fname,idnum FROM sms,tsulat ORDER BY tsulat.sname,fname INTO CURSOR MyDataB

But it might also need tsulat to be linked to sms by a where statement of some kind:

Code:
SELECT tsulat.sname,fname,idnum FROM sms,tsulat where sms.tsuid=tsulat.UID ORDER BY tsulat.sname,fname INTO CURSOR MyDataB

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I've also seen this error occiur when you have more than one field in the RowSource, and you add an alias to the second or subsequent field.

For example, if you do this:

Code:
THIS.RowSource = "Customer.Cust_ID,Customer.Cust_Name"

That will generate the "Field Phrase Not Found error", even though both fields are perfectly correct. What you need to do is to omit the second alias. In other words, do this:

Code:
THIS.RowSource = "Customer.Cust_ID,Cust_Name"

Then the error will go away.

Now you might think that's totally illogical and counter-intuitive. And you would be right.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Just rereading the OP's code, the init method opens tsulat as alias sms, so perhaps that is where the problem comes from (Mike's answers not foregoing)

Code:
SELECT sname,fname,idnum FROM sms ORDER BY sname,fname INTO CURSOR MyDataB

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
You might be right, Griff. So the RowSource is set to MyDataB, which is the name of the cursor. In other words, she is not specifying any fields for the RowSource. I think that's OK, but I'm not sure. I'll wait until we hear back from here.

By the way, the stuff in my last post above (abouve omiting the second and subsequent alias) isn't necessarily connected with this particular problem. I posted it because it catches a lot of people - and is quite unexpected.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
RowSourcetype 6 is fields, so your RowSource needs to list at least one field.

Tamar
 
Hi,

Either set RowSourceType = 2 - Alias() - with the corresponding ColumnCount number or as Tamar and others suggested add the desired field list.

BTW, the are some other gotchas:

- the INIT and the COMBO1.CLICK procedures have no ENDPROC statements

- you may want to use the WITH ... ENDWITH statements while referencing the same object

Code:
[highlight #FCE94F]your code 
[/highlight]
this.oGrid1.width = 400
this.oGrid1.Column1.Width = 100

this.oGrid1.Column1.Header1.caption = "Name of Student"
this.oGrid1.Column1.Header1.fontname = "Bernard MT Condensed"
*this.oGrid1.Column2.Header1.FontSize = 11
this.oGrid1.Column1.Width = 120

this.oGrid1.Column2.Header1.caption = "ID Number"
this.oGrid1.Column2.Header1.fontname = "Bernard MT Condensed"
*this.oGrid1.Column2.Header1.FontSize = 11
this.oGrid1.Column2.Width = 150

[highlight #FCE94F]suggestion
[/highlight]
WTIH this.oGrid1
.Width = 400

.Column1.Width = 100
.Column1.Header1.caption = "Name of Student"
.Column1.Header1.fontname = "Bernard MT Condensed"

.Column2.Width = 150
.Column2.Header1.caption = "ID Number"
.Column2.Header1.fontname = "Bernard MT Condensed"
ENDWITH

Furthermore,
- why do you create the different cursors in the LOAD procedure when you immediately overwrite them with the COMBO1.CLICK()?
- why do you index the tables each time you load them? They should be indexed when created or if it's a temporary index, you may want to create a cursor ORDERed By
- why do you use meaningless field names - in a few months your code will be extremely hard to maintain

hth

MarK
 
hi everyone... i've tried everything that everyone suggested... but no luck... and up to now i'm still trying my best to look for the error, ive put everything one by one... the errors start whenever i i combo1 as combobox... btw this is in page in a form....does it have something to do with the page? when i try doing it in a form, its all working... thanks everyone im overwhelmed with all your answers....
 
If it is within a pageframe on a form the notation *could* change to

Code:
this.pageframe1.oGrid1.Column1.Header1.caption = "Name of Student"

But it would depend on what exactly 'this' is.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Mandy,

Can you create a new form to reproduce the error?

In other words, start a new form. Then gradually add the controls and the code. Keep testing it until the error re-appears. Then let us know the last thing that you did before you got the error.

If possible, post all the code you have added up to that point. But when you do, please remove any code that is not relevant to the problem. We probably don't need all your SELECT statements, or settings for the form height or width, or the various SET commands. Just the minimum code that reproduces the error.

Even if that doesn't lead directly to the solution, it is a good problem-solving technique that could help you in similar situations.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
thanks griff... i am suspecting that MydataB is not showing any data even if i have define it the load procedure... i see the table MydataB but it has no data in it....
 
You could open MyDataB before the form loads, it would then be guaranteed to be visible to your load

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Hi Mike... in a form it works perfectly, the combox with fieldname name and idnum... but when i transfer it to mypageframe... the MydataB is not showing any names... even if it is desame init content with the form that is working.... I am still trying everything to solve... thanks Mike
 
Thank you so much mark.... I'll try to analyze this code... to correct my codes... thanks and God Bless...
 
Hi

... below the slightly pimped up code with some visual clues. Enjoy!

Code:
PUBLIC go_Form as Object

go_Form = CreateObject("frmForm")
go_Form.Visible = .T.
go_Form.Show

READ Events
CLOSE ALL
CLEAR ALL

**********

DEFINE CLASS frmForm As Form
	Width = 450
	MinWidth = 450
	MaxWidth = 450
	Height = 360
	MinHeight = 360
	AutoCenter = .T.
	ShowTips = .T.
	Themes = .F.
	Caption = "Select Students"
  
*!*	  ADD objects with their procedures
  
	ADD OBJECT pgfNames as Pageframe WITH ;
		Top = 48, ;
		Left = 12, ;
		Height = 258, ;
		Width = 426, ;
		Anchor = 15, ;
		PageCount = 2
		
		PROCEDURE pgfNames.Init()
			LOCAL loPage as Object
			
			FOR i = 1 TO This.PageCount
				loPage = This.Pages(i)
				loPage.AddObject("grdNames","grdBase")
				loPage.Caption = ICASE(i = 1, "All Students", "Selected Student")

			ENDFOR 
		ENDPROC 
		
		PROCEDURE pgfNames.Page1.Click()
			ThisForm.UnBold()			
			This.FontBold = .T.
			This.BackColor = RGB(230, 230, 230)
			
		ENDPROC 
		
		PROCEDURE pgfNames.Page2.Click()

			ThisForm.UnBold()			

			WITH This
				.FontBold = .T.
				.BackColor = RGB(230, 230, 230)
				
				WITH .grdNames
					IF USED("CSRFILTER")
						.Visible = .T.
						.BackColor = RGB(0, 240, 240)
						.ColumnCount = -1
						.RecordSource = "csrFilter"

						.Column1.Header1.Caption = "ID"
						.Column2.Header1.Caption = "Name"
						.Column3.Header1.Caption = "Gender"
						.Column4.Header1.Caption = "DateTime"

					ELSE
						.Visible = .F.
					ENDIF 
					
					.Refresh()
					
				ENDWITH 
			ENDWITH 
		ENDPROC 

	ADD OBJECT cboNames AS COMBOBOX WITH ;
		RowSourceType = 6, ;
		RowSource = "csrDemo.cCode,cName", ;
		ColumnCount = 2, ;
		ColumnWidths = "48, 96", ;
		Style = 2, ;
		Height = 24, ;
		Left = 12, ;
		Top = 12, ;
		Width = 210
	
		PROCEDURE cboNames.Click()
			LOCAL lcValue as Character
			
			lcValue = ALLTRIM(This.List(This.Listindex,1))
		
			SELECT * FROM csrDemo WHERE cCode = lcValue INTO CURSOR csrFilter
			
			WITH ThisForm.pgfNames
				.ActivePage = 2
				.Pages(2).Click()
		
			ENDWITH 
		ENDPROC 

	ADD OBJECT cmdExit As CommandButton WITH ;
		Width = 60, Height = 30, Left = 12, Top = 318, Caption = "Release", Anchor = 6

		PROCEDURE cmdExit.Click()
			CLEAR Events
			ThisForm.Release

		ENDPROC
		
*!*		ADD the form procedures
	
	PROCEDURE UnBold()
		LOCAL loPage as Object
			
		FOR EACH loPage IN This.pgfNames.Pages
				loPage.FontBold = .F.
				loPage.BackColor = RGB(240, 240, 240)
		ENDFOR 
	ENDPROC 
	
	
	PROCEDURE Load()
	
		CREATE CURSOR csrdemo (cCode C(3), cName C(10), cGender C(1), tDTime T)
		
		INSERT INTO csrdemo VALUES ('001','Henry','M',DATETIME())
		INSERT INTO csrdemo VALUES ('011','Jenny','F',DATETIME())
		INSERT INTO csrdemo VALUES ('004','Eve','F',DATETIME())
		INSERT INTO csrdemo VALUES ('005','Lauren','F',DATETIME())
		INSERT INTO csrdemo VALUES ('009','Bob','M',DATETIME())
		
		LOCATE 

	ENDPROC
	
	PROCEDURE Destroy()
		CLEAR Events
		ThisForm.Release

	ENDPROC
ENDDEFINE

**********

DEFINE CLASS grdBase as Grid 
	Visible = .T.
	Top = 12
	Left = 12
	Width = 402
	Height = 210
	Anchor = 15
	ReadOnly = .T.
	DeleteMark = .F.

	PROCEDURE Init()
		WITH This
			.Column1.Header1.Caption = "ID"
			.Column2.Header1.Caption = "Name"
			.Column3.Header1.Caption = "Gender"
			.Column4.Header1.Caption = "DateTime"
		ENDWITH 
	ENDPROC 
ENDDEFINE 

**********

MarK
 
Wow!!!! just wow..... May i use some of you codes mjcmkrsr?! ive tried running it and it looks so good... its so user friendly... Thanks and God bless....
 
Hi Mandy,

Glad to read that you liked this piece of code. You may of course use it and adapt it to your needs. However, and more important, is to get comfortable with the concepts behind it.

"If you want to make your FoxPro programs scream (and not vice versa) ..." as T. Granor (if I remember well) wrote, I suggest some books :

- Programming Visual FoxPro by Whil Henzen
- Hacker's Guide to Visual Foxpro 7 by Tamar Granor, Ted Roche et al
- What's New in Nine? by Tamar Granor, Doug Hennig et al
- 1001 Things You Wanted to Know About Visual FoxPro by Marcia Atkins, Andy Kramek and Rick Schummer

It's a start. You'll find these and many more on

[link ][/url]

hth

MarK
 
"If you want to make your FoxPro programs scream (and not vice versa) ..." as T. Granor (if I remember well) wrote

I've been trying to think since yesterday whether I wrote that. Looks like it was in Addison-Wesley's promotional text for the first edition.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top