×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

'Field' phrase not found
4

'Field' phrase not found

'Field' phrase not found

(OP)
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

RE: 'Field' phrase not found

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 Smileing

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.

RE: 'Field' phrase not found

This error usually occurs with a combo box or list box, when you set the RowSource incorrectly. Check that the field specified in the RowsSourse is present in the relevant table.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: 'Field' phrase not found

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

RE: 'Field' phrase not found

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 Smileing

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.

RE: 'Field' phrase not found

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

RE: 'Field' phrase not found

RowSourcetype 6 is fields, so your RowSource needs to list at least one field.

Tamar

RE: 'Field' phrase not found

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 -->

your code 

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

suggestion

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

RE: 'Field' phrase not found

(OP)
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....

RE: 'Field' phrase not found

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 Smileing

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.

RE: 'Field' phrase not found

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

RE: 'Field' phrase not found

(OP)
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....

RE: 'Field' phrase not found

You could open MyDataB before the form loads, it would then be guaranteed to be visible to your load

Regards

Griff
Keep Smileing

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.

RE: 'Field' phrase not found

(OP)
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

RE: 'Field' phrase not found

(OP)
Thank you so much mark.... I'll try to analyze this code... to correct my codes... thanks and God Bless...

RE: 'Field' phrase not found

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

RE: 'Field' phrase not found

(OP)
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....

RE: 'Field' phrase not found

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

http://hentzenwerke.com/download/zdownload.htm

hth

MarK

RE: 'Field' phrase not found

(OP)
Thanks so much Mark for your kindness....

RE: 'Field' phrase not found

Quote:


"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

RE: 'Field' phrase not found

(OP)
Hello everyone.. for almost 4 days i am still trying to figure out what caused the field phrase not found... i have done what mike said to create new form and gradually add other things... but when i add combobox, field phrase persistently appear... may i ask help from anyone... here are the codes... i have removed most of he objects and other things.. thanks in advance...

DEFINE CLASS mypage5 as Page

FontBold = .T.
Caption = "Students Record"
Forecolor = rgb(128,0,0)

ADD OBJECT oGrid1 AS Grid WITH ;
RecordSource="MyDataB", ;
ColumnCount=2, ;
Width = 200, ;
Top = 50, ;
Height = 100, ;
FontSize = 10, ;
left = 300,;
Wordwrap = .t.

ADD OBJECT text90 AS COMBOBOX WITH ; && Name
RowSourceType = 7, RowSource = "MyDataB",;
columncount = 2,;
Height = 23, ;
Left = 305, ;
Top = 5, ;
Width = 210

ADD OBJECT Text1 AS combobox WITH ; &&
Height = 32, ;
Left = 400, ;
Top = 337, ;
Width = 150,;
RowSourceType = 1, RowSource = "\<School Fees,\<Back,\<Books,\<Uniform,",;
decimals = 2,;
fontsize = 11

ADD OBJECT oButton2 AS CommandButton WITH ;
TOP = 380,;
Left = 600, ;
Height = 35, ;
Width = 100, ;
fontname = "BRITANNIC BOLD",;
FontSize = 14, ;
ForeColor = RGB(0,128,128),;
Caption = "OK"

PROCEDURE load()

SELECT ALLTRIM(sname) + ", " + ALLTRIM(fname), idnum FROM SMS ORDER BY sname, fname INTO CURSOR MyDataB

ENDPROC


PROCEDURE oGrid1.Init()

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

this.parent.oGrid1.Column1.Header1.caption = "Name of Student"
this.parent.oGrid1.Column1.Header1.fontname = "Bernard MT Condensed"
this.parent.oGrid1.Column1.Width = 120

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

ENDPROC

PROCEDURE text1.click()

SELECT 1

SET relation TO idnum INTO pay

IDNAMBER = ALLTRIM(this.parent.text1.value)

this.parent.oGrid1.RecordSource = SPACE(0)

SELECT ALLTRIM(sname) + ", "+ ALLTRIM(fname), idnum FROM sms WHERE idnum = ALLTRIM(this.parent.text1.value) INTO CURSOR MyDataB

this.parent.oGrid2.RecordSource = SPACE(0)

ENDPROC

PROCEDURE oButton2.Click

SELECT 2

SEEK ALLTRIM(idnum)

for i=1 to 10

m.deyta = "P"+transform(m.i)

IF &deyta=0
replace &deyta with this.parent.text31.value
this.parent.oGrid2.refresh()
MESSAGEBOX("Recorded!",0+64,"Students' Record 2021")
EXIT
ENDIF

IF i = 10
MESSAGEBOX("No more!",0+64,"Students' Record 2021")
ENDIF
NEXT

this.parent.Refresh()

endproc


ENDDEFINE

RE: 'Field' phrase not found

Why not try adding the combobox, but not setting the properties below until the form has initiated?

RowSourceType = 7, RowSource = "MyDataB",;
columncount = 2,;

Regards

Griff
Keep Smileing

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.

RE: 'Field' phrase not found

Mandy, this is somewhat confusing.

In the first code that you posted, you had one combo, with a RowSourceType of 6. The error message specifically related to that situation, and is caused by an incorrect setting of the RowSource. I explained that at the outset.

I later suggested that you start a new form from scratch and gradually add controls until the problem re-appears, which you say you have done. But, in your latest code, you now have two combos. One has a RowSourceType of 1, with a RowSource consisting of a list of hard-coded value. Syntactically, that looks correct (except perhaps for the spurious comma after "Uniform", but let's not worry about that). The other combo has a RowSourceType of 7, with a RowsSource containing a single filename, which doesn't make any sense.

It's hard to for us to follow what is happening when you change the context in this way. Also, I asked you to post the minimum code that would enable us to reproduce the problem. What you now given us is a definition of a class, which is based on the Page class. As it stands, that is no help at all. We don't know how you are going to use that class definition, or how it will lead to the error arising. Without that context, we have no way of reproducing the problem. And you have also included a lot of code not related to the problem, which does nothing to help us understand what is going on.

If it is at all possible for you to create the minimum form that reproduces the problem, we will do our best to help.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: 'Field' phrase not found

(OP)
Thanks so much Mike... I will still try to solve the problem first to the best of my ability before i ask help from you all... i really want to learn...

RE: 'Field' phrase not found

Hi Mandy,

I rearranged your code and deleted some syntax quirks in order to make it more readable. I also annotated it in order to show where some of the hick-ups are.

p.s. Why the ComboBox "Text90" since you don't do anything with its results? Btw oButton2.Click() doesn't do anything either

CODE -->

DEFINE CLASS mypage5 as Page

	FontBold = .T.
	Caption = "Students Record"
	Forecolor = rgb(128,0,0)

	ADD OBJECT oGrid1 AS Grid WITH ;
		RecordSource = "MyDataB", ;
		ColumnCount = 2, ;
		Width = 200, ;
		Top = 50, ;
		Height = 100, ;
		FontSize = 10, ;
		left = 300, ;
		Wordwrap = .t.
		
		PROCEDURE oGrid1.Init()

			WITH This
				.width = 400 && why define twice see above

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

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

	ADD OBJECT text90 AS COMBOBOX WITH ; 
		RowSourceType = 7, ; && does not make sense in this case - please choose appropriate type number
		RowSource = "MyDataB", ; && you have to specify the fields
		columncount = 2, ;
		Height = 23, ;
		Left = 305, ;
		Top = 5, ;
		Width = 210

	ADD OBJECT Text1 AS combobox WITH ; && 
		Height = 32, ;
		Left = 400, ;
		Top = 337, ;
		Width = 150, ;
		RowSourceType = 1, ;
		RowSource = "\<School Fees,\<Back,\<Books,\<Uniform", ;
		decimals = 2, ;
		fontsize = 11
		
		PROCEDURE text1.click()

			SELECT 1 && please select Alias()

			SET relation TO idnum INTO pay

			IDNAMBER = ALLTRIM(this.value)

			this.parent.oGrid1.RecordSource = SPACE(0) && does not make sense

			SELECT ALLTRIM(sname) + ", "+ ALLTRIM(fname), idnum FROM sms WHERE idnum = ALLTRIM(this.value) INTO CURSOR MyDataB

			this.parent.oGrid2.RecordSource = SPACE(0) && hence your grid does NOT show any data

		ENDPROC
		
	ADD OBJECT oButton2 AS CommandButton WITH ;
		TOP = 380, ;
		Left = 600, ;
		Height = 35, ;
		Width = 100, ;
		fontname = "BRITANNIC BOLD", ;
		FontSize = 14, ;
		ForeColor = RGB(0,128,128), ;
		Caption = "OK"


		PROCEDURE oButton2.Click

			SELECT 2

			SEEK ALLTRIM(idnum) && is the cursor indexed?

			for i=1 to 10

			m.deyta = "P"+transform(m.i)

                                IF &deyta = 0
                                        replace &deyta with this.parent.text31.value
					this.parent.oGrid2.refresh()
					MESSAGEBOX("Recorded!",0+64,"Students' Record 2021")
					EXIT
				ENDIF

				IF i = 10
					MESSAGEBOX("No more!",0+64,"Students' Record 2021")
				ENDIF
			NEXT

			this.parent.Refresh()

		ENDPROC 

*!*			PROCEDURE load() && a page does not have a load method/event

*!*				SELECT ALLTRIM(sname) + ", " + ALLTRIM(fname), idnum FROM SMS ORDER BY sname, fname INTO CURSOR MyDataB

*!*			ENDPROC

ENDDEFINE 

hth

MarK

RE: 'Field' phrase not found

Quote:

I will still try to solve the problem first to the best of my ability before i ask help from you all.

Mandy, I am definitely not saying that you should not ask for help. Rather, that we need a clear and concise explanation of the problem in order to solve it - and ideally in a way that lets us reproduce the problem. The last thing I want to do is to discourage you from asking questions.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: 'Field' phrase not found

(OP)
hi Mike... i am really really sorry from the bottom of my heart, you might have interpreted what i meant... i am just so ashamed that i always ask for solutions from you all.... im really really sorry.. hope you would still help me.... thanks so much Mike... God Bless

RE: 'Field' phrase not found

(OP)
Thank you so much mjcmkrsr... very comprehensive... so helpful, hence i will know where to start checking.... God bless you...

RE: 'Field' phrase not found

(OP)
Hi mjcmkrsr... i was able to get rid of the field phrase problem... after i have followed all your suggestions... The page is now showing the data, however in my combobox, it does show the data in the cursor even though i have changed the RowSourceType = 6, ;RowSource = "MyDataB", ; but in the combobox it is showing another table not the Cursor (MyDataB). is there something i am missing? thanks in advanced mjcmkrsr and everyone.... God Bless.....

RE: 'Field' phrase not found

Hi Mandy,

Do you mean

CODE -->

ADD OBJECT text90 AS COMBOBOX WITH ; 
		RowSourceType = 7, ; && does not make sense in this case - please choose appropriate type number
		RowSource = "MyDataB", ; && you have to specify the fields
		columncount = 2, ;
		Height = 23, ;
		Left = 305, ;
		Top = 5, ;
		Width = 210 

If yes - you just may delete that snippet since it doesn't do anything. NO PROCEDURE text90.... statement is following

If no - please show the code

hth

MarK

RE: 'Field' phrase not found

Hi Mandy,

Please find below a demo integrating YOUR (adapted) code. It is just a sketch of how you COULD achieve your goals - I made three assumptions - that you have one table for the students, one for the books and one for the fees. However I did nor relate them (parent-children relation) - but that could easily be done (cCode could be the link field).

Playground: You choose a name on the grid, choose an item from the combobox and you go. Enjoy

CODE -->

PUBLIC go_Form

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

READ Events

CLOSE ALL 
CLEAR ALL
RETURN 

*********

DEFINE CLASS frmForm As Form
	Width = 480
	MinWidth = 480
	MaxWidth = 480
	Height = 450
	MinHeight = 450
	AutoCenter = .T.
	Caption = "Grids - Editbox versus MemoField"
	ShowTips = .T.
	Themes = .F.
	
	
	ADD OBJECT pgfNames as Pageframe WITH ;
		Top = 12, ;
		Left = 12, ;
		Height = 450 - 24 - 42 , ;
		Width = 480 - 24, ;
		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.grdNames.RecordSource = ICASE(i = 1, "csrBooks", "csrFees")

				loPage.Caption = ICASE(i = 1, "Books", "Fees")

			ENDFOR 

			This.AddObject("pagPage3","claPage")

		ENDPROC 
		
		PROCEDURE pgfNames.Page1.Click()
			This.grdNames.Visible = .T.
			This.Refresh()
		
		ENDPROC 

		PROCEDURE pgfNames.Page2.Click()
			This.grdNames.Visible = .T.
			This.Refresh()
		
		ENDPROC 
		
	ADD OBJECT cmdExit As CommandButton WITH ;
    	Width = 60, Height = 30, Left = 480 - 12 - 60, Top = 450 - 12 - 30, Caption = "Exit", Anchor = 12
    	
		PROCEDURE cmdExit.Click()
			ThisForm.Release
			CLEAR Events
		
		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() - 6)
		INSERT INTO csrdemo VALUES ('011','Jenny','F',DATETIME() - 5)
		INSERT INTO csrdemo VALUES ('004','Eve','F',DATETIME() - 4)
		INSERT INTO csrdemo VALUES ('005','Lauren','F',DATETIME() - 3)
		INSERT INTO csrdemo VALUES ('009','Bob','M',DATETIME() - 2)
		INSERT INTO csrdemo VALUES ('006','Sharon','F',DATETIME() - 1)
		
		LOCATE 

		CREATE CURSOR csrBooks (cCode C(3), cName C(10), cTitle C(25), tDTime T)

		CREATE CURSOR csrFees (cCode C(3), cName C(10), iFees I, tDTime T)
		
	ENDPROC
			
	PROCEDURE Destroy()
		This.cmdExit.Click()
	
	ENDPROC 
ENDDEFINE 

*********
DEFINE CLASS grdBase as Grid 
	Visible = .F.
	Top = 12
	Left = 12
	Width = 480 - 24 - 24
	Height = 450 - 24 - 48 - 48
	BackColor = RGB(0, 246, 246)
	RowHeight = 21
	AllowRowSizing = .F.
	HeaderHeight = 21
	AllowHeaderSizing = .F.
	Anchor = 15
	ReadOnly = .T.
	DeleteMark = .F.
	ColumnCount = -1

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

*********

DEFINE CLASS claPage as Page

	FontBold = .T.
	Caption = "Students Record"
	Forecolor = rgb(128,0,0)

	ADD OBJECT oGrid1 AS Grid WITH ;
		RecordSource = "csrDemo", ;
		ColumnCount = 2, ;
		Width = 480 - 48, ;
		Top = 54, ;
		Height = 450 - 24 - 42 - 24 - 24 - 54, ;
		FontSize = 10, ;
		left = 12,;
		Wordwrap = .t.

		PROCEDURE oGrid1.Init()

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

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

		ENDPROC

	ADD OBJECT cboSFBBU AS combobox WITH ; && 
		Height = 24, ;
		Left = 12, ;
		Top = 12, ;
		Width = 150, ;
		RowSourceType = 1, ;
		RowSource = "\<School Fees,\<Back,\<Books,\<Uniform", ;
		fontsize = 10
		
		PROCEDURE cboSFBBU.click()
*!*			your code goes here an delete the code below
		
			WAIT WINDOW + "You selected student " + ALLTRIM(csrDemo.cName) + " and the table "+ This.Value NOWAIT 
			
		ENDPROC
		
	ADD OBJECT cmdButton AS CommandButton WITH ;
		TOP = 12, ;
		Left = 174, ;
		Height = 24, ;
		Width = 48, ;
		fontname = "BRITANNIC BOLD", ;
		FontSize = 14, ;
		ForeColor = RGB(0,128,128), ;
		Caption = "OK"

		PROCEDURE cmdButton.Click()
*!*				your code goes here and delete the code below
			
			DO CASE 
				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "School Fees"
					
					INSERT INTO csrFees VALUES (csrDemo.cCode, csrDemo.cName, 250, DATETIME())

					WAIT WINDOW + "Fees added for " + ALLTRIM(csrDemo.cName) +" in table " + This.Parent.cboSFBBU.Value TIMEOUT 3 

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Back"
					
					WAIT WINDOW + "You may add data for " + ALLTRIM(csrDemo.cName) + " into table [Back]" TIMEOUT 2

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Books"

					INSERT INTO csrBooks VALUES (csrDemo.cCode, csrDemo.cName, "Any Book", DATETIME())

					WAIT WINDOW + "Book added for " + ALLTRIM(csrDemo.cName) +" in table " + This.Parent.cboSFBBU.Value TIMEOUT 3 

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Uniform"
					
					WAIT WINDOW + "You may add data for " + ALLTRIM(csrDemo.cName) + " into table [Uniforms]" TIMEOUT 2
					
				OTHERWISE 
					
					WAIT WINDOW + "No table select" TIMEOUT 5
				
			ENDCASE 
			

		
		ENDPROC 

ENDDEFINE
*********
 

hth

MarK

RE: 'Field' phrase not found

(OP)
Thank you Mark for this... I'll try to understand it well.... I'll keep you posted always Mark.... Thanks so much....

RE: 'Field' phrase not found

Hi Mandy

... and a more user friendly version. Enjoy.

CODE -->

PUBLIC go_Form

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

READ Events

CLOSE ALL 
CLEAR ALL
RETURN 

*********

DEFINE CLASS frmForm As Form
	Width = 480
	MinWidth = 480
	MaxWidth = 510
	Height = 450
	MinHeight = 450
	AutoCenter = .T.
	Caption = "Students - Fees - Books"
	ShowTips = .T.
	Themes = .F.
	
	
	ADD OBJECT pgfNames as Pageframe WITH ;
		Top = 12, ;
		Left = 12, ;
		Height = 450 - 24 - 42 , ;
		Width = 480 - 24, ;
		Anchor = 15, ;
		PageCount = 0
		
		PROCEDURE pgfNames.Init()
			LOCAL loPage as Object
			
			WITH This
				.NewObject("Page1","pagBase")
				.NewObject("Page2","Page")
				.NewObject("Page3","Page")
				.NewObject("Page4","Page")
				.NewObject("Page5","Page")

			ENDWITH 

			FOR i = 2 TO 5
				loPage = This.Pages(i)
				WITH loPage
					.Caption = ICASE(i = 2, "Fees", i = 3, "Back", i = 4, "Books", "Uniform")
					.NewObject("grdNames","grdBase")
					.grdNames.Visible = .F.

				ENDWITH 
			ENDFOR 
		ENDPROC 
		
	ADD OBJECT cmdExit As CommandButton WITH ;
    	Width = 60, Height = 30, Left = 480 - 12 - 60, Top = 450 - 12 - 30, Caption = "Exit", Anchor = 12
    	
		PROCEDURE cmdExit.Click()
			ThisForm.Release
			CLEAR Events
		
		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() - 6)
		INSERT INTO csrdemo VALUES ('011','Jenny','F',DATETIME() - 5)
		INSERT INTO csrdemo VALUES ('004','Eve','F',DATETIME() - 4)
		INSERT INTO csrdemo VALUES ('005','Lauren','F',DATETIME() - 3)
		INSERT INTO csrdemo VALUES ('009','Bob','M',DATETIME() - 2)
		INSERT INTO csrdemo VALUES ('006','Sharon','F',DATETIME() - 1)
		INSERT INTO csrdemo VALUES ('002','Bobby','X',DATETIME() - 7)
		
		LOCATE 

		CREATE CURSOR csrBooks (cCode C(3), cTitle C(25), tDTime T)

		CREATE CURSOR csrFees (cCode C(3), iFees I, tDTime T)
		
	ENDPROC
	
	PROCEDURE Init()
		DODEFAULT()
		
		BINDEVENT(This.pgfNames.Page2, "Click", This, "PTwoClick")
		BINDEVENT(This.pgfNames.Page3, "Click", This, "PThreeClick")
		BINDEVENT(This.pgfNames.Page4, "Click", This, "PFourClick")
		BINDEVENT(This.pgfNames.Page5, "Click", This, "PFiveClick")

	ENDPROC 
	
	PROCEDURE PTwoClick()
		LOCAL lcName as Character 
		
		WITH ThisForm.pgfNames
			.ActivePage = 2
			.Page2.grdNames.Visible = .T.
			
		ENDWITH 
		
		lcName = csrDemo.cName
		
		SELECT csrDemo.cCode, csrDemo.cName, NVL(iFees, 0), NVL(csrFees.tDTime, DATETIME(2000,01,01)) FROM csrDemo ;
			JOIN csrFees ON csrDemo.cCode = csrFees.cCode ;
			WHERE csrDemo.cName = lcName ;
			INTO CURSOR csrView
		
		IF _Tally > 0
			WITH ThisForm.pgfNames.Page2
				WITH .grdNames
					.ColumnCount = -1
					.RecordSource = "CSRVIEW"

					.Column1.Width = 60
					.Column2.Width = 120
					.Column3.Width = 60
					.Column4.Width = 120
				
					.Column1.Header1.Caption = "ID Code"
					.Column2.Header1.Caption = "Name"
					.Column3.Header1.Caption = "Fee"
					.Column4.Header1.Caption = "Date Time"

				ENDWITH 
				
				.Refresh()

			ENDWITH 
		ELSE
			WITH ThisForm.pgfNames.Page2
				.grdNames.Visible = .F.
				.Refresh()
				
			ENDWITH 		

			= MESSAGEBOX("No data found!", 64, "Paid Fees", 3000)
		
		ENDIF 
	ENDPROC
	
	PROCEDURE PThreeClick()
		WITH ThisForm.pgfNames
			.ActivePage = 3
			.Pages(3).grdNames.Visible = .F.
			.Pages(3).Refresh()
			
		ENDWITH 
		
		= MESSAGEBOX("Under construction!", 64, "Page 3 clicked", 3000)
		
	ENDPROC

	PROCEDURE PFourClick()
		LOCAL lcName as Character 
	
		WITH ThisForm.pgfNames
			.ActivePage = 4
			.Page4.grdNames.Visible = .T.
			
		ENDWITH 
		
		lcName = csrDemo.cName
		
		SELECT csrDemo.cCode, csrDemo.cName, NVL(cTitle, "N.N."), NVL(csrBooks.tDTime, DATETIME(2000,01,01)) FROM csrDemo ;
			JOIN csrBooks ON csrDemo.cCode = csrBooks.cCode ;
			WHERE csrDemo.cName = lcName ;
			INTO CURSOR csrView
			
		IF _Tally > 0
			
			WITH ThisForm.pgfNames.Page4
				WITH .grdNames
					.ColumnCount = -1
					.RecordSource = "CSRVIEW"

					.Column1.Width = 60
					.Column2.Width = 120
					.Column3.Width = 120
					.Column4.Width = 120
				
					.Column1.Header1.Caption = "ID Code"
					.Column2.Header1.Caption = "Name"
					.Column3.Header1.Caption = "Title"
					.Column4.Header1.Caption = "Date Time"
					
				ENDWITH 
				
				.Refresh()

			ENDWITH 	
		ELSE
			WITH ThisForm.pgfNames.Page4
				.grdNames.Visible = .F.
				.Refresh()
				
			ENDWITH 		

			= MESSAGEBOX("No data found!", 64, "Books", 3000)

		ENDIF 
	ENDPROC
			
	PROCEDURE PFiveClick()
		WITH ThisForm.pgfNames
			.ActivePage = 5
			.Pages(5).grdNames.Visible = .F.
			.Pages(5).Refresh()
			
		ENDWITH 

		= MESSAGEBOX("Under construction!", 64, "Page 5 clicked", 3000)
	
	ENDPROC

	
	PROCEDURE Destroy()
		This.cmdExit.Click()
	
	ENDPROC 
ENDDEFINE 

*********
DEFINE CLASS grdBase as Grid 
	Top = 12
	Left = 12
	Width = 480 - 24 - 24
	Height = 450 - 24 - 48 - 48
	BackColor = RGB(0, 246, 246)
	RowHeight = 21
	AllowRowSizing = .F.
	HeaderHeight = 21
	AllowHeaderSizing = .F.
	Anchor = 15
	ReadOnly = .T.
	DeleteMark = .F.

ENDDEFINE 

*********

DEFINE CLASS pagBase as Page

	FontBold = .T.
	Caption = "Students Record"
	Forecolor = RGB(128, 0, 0)

	ADD OBJECT grdStudents AS Grid WITH ;
		RecordSource = "csrDemo", ;
		ColumnCount = 3, ;
		Left = 12, ;
		Width = 480 - 48, ;
		Top = 54, ;
		Height = 450 - 24 - 42 - 24 - 24 - 54, ;
		Anchor = 15

		PROCEDURE grdStudents.Init()
			WITH This 
				.Column1.Header1.caption = "ID Number"
				.Column1.Header1.fontname = "Bernard MT Condensed"
				.Column1.Width = 120

				.Column2.Header1.caption = "Name of Student"
				.Column2.Header1.fontname = "Bernard MT Condensed"
				.Column2.Width = 150
			
				.Column3.Header1.caption = "Gender"
				.Column3.Header1.fontname = "Bernard MT Condensed"
				.Column3.Width = 60

			ENDWITH 
		ENDPROC
		
		PROCEDURE grdStudents.AfterRowColChange()
			LPARAMETERS nColIndex

			This.Parent.cmdAddData.Refresh()

		ENDPROC 

	ADD OBJECT cboSFBBU AS combobox WITH ; && 
		Height = 24, ;
		Left = 12, ;
		Top = 12, ;
		Width = 120, ;
		RowSourceType = 1, ;
		RowSource = "\<School Fees,\<Back,\<Books,\<Uniform"
		
		PROCEDURE cboSFBBU.click()
*!*			your code goes here - delete the code below

			WITH This.Parent.cmdAddData
				.Enabled = .T.
				.Refresh()

			ENDWITH 		
		ENDPROC
		
	ADD OBJECT cmdAddData AS CommandButton WITH ;
		TOP = 12, ;
		Left = 144, ;
		Height = 24, ;
		Autosize = .T., ;
		BackColor = RGB(180, 0, 0), ;
		ForeColor = RGB(252, 252, 252), ;
		Enabled = .F.
		
		PROCEDURE cmdAddData.Refresh()
			This.Caption = "Click to add data for " + ALLTRIM(csrDemo.cName) +" in table " + This.Parent.cboSFBBU.Value
			This.ToolTipText = IIF(This.Enabled, "Click to add data", "Select item from combobox to activate this button")

		ENDPROC 


		PROCEDURE cmdAddData.Click()
*!*				your code goes here - delete the code below
			
			DO CASE 
				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "School Fees"
					
					INSERT INTO csrFees VALUES (csrDemo.cCode, INT(250 * RAND()), DATETIME())
					
					WITH This
						.Enabled = .F.
						.Refresh()
					ENDWITH 

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Back"
					WAIT WINDOW + "You may add data for " + ALLTRIM(csrDemo.cName) + " into table [Back]" TIMEOUT 2

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Books"

					INSERT INTO csrBooks VALUES (csrDemo.cCode, "BK" + SYS(2015), DATETIME())

					WITH This
						.Enabled = .F.
						.Refresh()
						
					ENDWITH 

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Uniform"
					WAIT WINDOW + "You may add data for " + ALLTRIM(csrDemo.cName) + " into table [Uniforms]" TIMEOUT 2
					
				OTHERWISE 
					WAIT WINDOW + " No table selected! " TIMEOUT 5
				
			ENDCASE 
		ENDPROC 
ENDDEFINE
********* 

hth

MarK

RE: 'Field' phrase not found

(OP)
Hi Mark.... i am so overwhelmed with your so much help....I am so happy!! I'll study both and get some of it Mark..... thank you very much God Bless!!!!bigsmilebigsmile

RE: 'Field' phrase not found

Hi Mandy,

Thank you for the "laudatio". You may of course copy/paste as much code snippets as you like/need. Nevertheless I'd like to underline that this code was written under many assumptions: I don't know either the structure and number of tables you use nor the goals you aim to reach. I just read the code you published, took it up, made my guesses and tried to show you how you could - not necessarily have to - integrate it in a working application. The demo code works but it remains a demo with all its flaws!

It is up to you to sketch, draw and finetune your application, to define your tables and to do the appropriate coding. Have fun!

hth

MarK

RE: 'Field' phrase not found

(OP)
Hi Mark... sorry i wasnt able to use some of your codes... so i have reviewed well my codes and took some of your corrections... I was able to get rid of the field phrase not found, unfortunately there two issues that came up....
1. The data(MyDataB) in oGrid1 does not load when i open the page
2. Table has no index order set error when i click the combobox.

I have a form which has 5 pages, all four pages are running well but the 5th page run with the two errors mentioned above. The codes are below... I want the Cursor to be loaded in oGrid1 when the page is selected so that MyDataB may be accesed in Text90 which is a combobox.... May i ask help again? Thanks and God Bless....

DEFINE CLASS mypage5 as Page

Picture = "C:\Program Files\SCMS Info Wave\Img\background3.jpg"
FontBold = .T.
Caption = "Students Record"
Forecolor = rgb(128,0,0)

ADD OBJECT oGrid1 AS Grid WITH ;
RecordSource="MyDataB", ;
columncount = 2,;
Width = 300, ;
Top = 50, ;
Height = 100, ;
FontSize = 10, ;
left = 400,;
Wordwrap = .t.

ADD OBJECT text90 AS COMBOBOX WITH ; && Name
RowSourceType = 6, RowSource = "MyDataB",;
columncount = 2,;
Height = 23, ;
Left = 305, ;
Top = 5, ;
Wordwrap = .t.,;
Width = 210

ADD OBJECT Text1 AS combobox WITH ; && Tbackaccount
Height = 32, ;
Left = 400, ;
Top = 337, ;
Width = 150,;
RowSourceType = 1, RowSource = "\<School Fees,\<Back,\<Books,\<Uniform,",;
decimals = 2,;
fontsize = 11

ADD OBJECT oButton2 AS CommandButton WITH ;
TOP = 380,;
Left = 600, ;
Height = 35, ;
Width = 100, ;
fontname = "BRITANNIC BOLD",;
FontSize = 14, ;
ForeColor = RGB(0,128,128),;
Caption = "OK"

PROCEDURE Load()

SELECT ALLTRIM(sname) + ", " + ALLTRIM(fname), idnum FROM SMS ORDER BY sname, fname INTO CURSOR MyDataB

ENDPROC

PROCEDURE oGrid1.init

SET PATH TO c:
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 transaction EXCLUSIVE ALIAS trans
INDEX on idnum TO idnumx3

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

SET RELATION TO IDNUM INTO trans

this.parent.oGrid1.Column1.Width = 180

this.parent.oGrid1.Column1.Header1.caption = "Name of Student"
this.parent.oGrid1.Column1.Header1.fontname = "Bernard MT Condensed"
this.parent.oGrid1.Column1.Width = 150

this.parent.oGrid1.Column2.Header1.caption = "ID Number"
this.parent.oGrid1.Column2.Header1.fontname = "Bernard MT Condensed"
this.parent.oGrid1.Column2.Width = 90

SELECT ALLTRIM(sname) + ", " + ALLTRIM(fname), idnum FROM SMS ORDER BY sname, fname INTO CURSOR MyDataB

ENDPROC


PROCEDURE text90.click()

this.parent.oGrid1.RecordSource = SPACE(0)
SELECT ALLTRIM(sname) + ", "+ ALLTRIM(fname), idnum FROM sms ORDER BY sname INTO CURSOR MyDataB
this.parent.oGrid1.RecordSource = "MyDataB"


SEEK alltrim(MyDataB.idnum)

IF FOUND()

code code code...

Endif

ENDPROC

PROCEDURE oButton2.Click

SELECT 2

SEEK ALLTRIM(idnum)

for i=1 to 10

m.deyta = "P"+transform(m.i)

IF &deyta=0
replace &deyta with this.parent.text31.value
this.parent.oGrid1.refresh()
MESSAGEBOX("Payment Recorded to SCHOOL FEES!",0+64,"Students' Record 2021")
EXIT
ENDIF

IF i = 10
MESSAGEBOX("No more Field to record SCHOOL FEES transaction!",0+64,"Students' Record 2021")
ENDIF
NEXT

this.parent.Refresh()

ENDPROC


ENDDEFINE

RE: 'Field' phrase not found

Hi Mandy,

Did you consider all the advice the Tek-Tips community gave you? Did you run my Demo-code? Do you understand how it works? If you answer YES to all the question why are there still all the quirks in your code? Just to name a few:

CODE -->

ADD OBJECT text90 AS COMBOBOX WITH ; && Name
RowSourceType = 6, ;
RowSource = "MyDataB",; && This does NOT work - you have to add the field names e.g. MyDataB.Field1, Field2 ... 
columncount = 2,;
Height = 23, ;
Left = 305, ;
Top = 5, ;
Wordwrap = .t.,;
Width = 210 

CODE -->

PROCEDURE Load()

SELECT ALLTRIM(sname) + ", " + ALLTRIM(fname), idnum FROM SMS ORDER BY sname, fname INTO CURSOR MyDataB

ENDPROC

A page does NOT have a load event/method - a form has one 

CODE -->

SET PATH TO c:
SET TALK OFF
SET BELL OFF
SET CENTURY ON
SET CONFIRM OFF
SET SAFETY OFF
SET ECHO OFF
SET ESCAPE OFF
SET AUTOSAVE ON

These settings should be set in the main program of your project - not the INIT of a page's grid
 

CODE -->

SELECT 2
USE transaction EXCLUSIVE ALIAS trans
INDEX on idnum TO idnumx3

Why do you reindex the table each time you click on Page5? Why do you still Select 2?

Suggestion - if it's not possible to open the table while loading the form

use transaction alias trans order idnum in 0 && that's a Zero
select trans 

aso

You might consider me being a bit harsh - but unfortunately none of all the suggestions we have made (Tamar, Mike, me, a.o.) since April 12th (start of this thread) are reflected in your code.

hth

Mark

RE: 'Field' phrase not found

(OP)
hi Mark... Ive tried everything and run all your suggestions... but i am confused on how to integrate my needs in the examples given... but i always read and study you examples Mark for future projects.... Im really sorry but im so confused... thank you so much Mark...God Bless

RE: 'Field' phrase not found

Hi Mandy

Quote:


i am confused on how to integrate my needs in the examples given

That's NOT the way to go - its the opposite: you define your needs and you check/decide whether some snippets of code - as is or modified - fit in.

hth

MarK

RE: 'Field' phrase not found

Hi Mandy

Please find below the same code with some explanations

CODE -->

*!*	Explanations: 
*!*	Below I instantiate a form, show it and read the EVENTS triggered

PUBLIC go_Form

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

READ Events

CLOSE ALL 
CLEAR ALL
RETURN 

*********

*!*	The frmForm class is defined

DEFINE CLASS frmForm As Form
	Width = 480
	MinWidth = 480
	MaxWidth = 510
	Height = 450
	MinHeight = 450
	AutoCenter = .T.
	Caption = "Students - Fees - Books"
	ShowTips = .T.
	Themes = .F.
	
*!*	I add a Pageframe to the form - it has 0 (zero) pages
	
	ADD OBJECT pgfNames as Pageframe WITH ;
		Top = 12, ;
		Left = 12, ;
		Height = 450 - 24 - 42 , ;
		Width = 480 - 24, ;
		Anchor = 15, ;
		PageCount = 0

*!*	Since the pageframe has no pages, I have to add some - the first one as an instance of the pagBase class (see below) 
*!*	and 4 (2 to 5) that are based on the VFP page class - this is done while the pageframe is INITiated
		
		PROCEDURE pgfNames.Init()
			LOCAL loPage as Object
			
			WITH This
				.NewObject("Page1","pagBase")
				.NewObject("Page2","Page")
				.NewObject("Page3","Page")
				.NewObject("Page4","Page")
				.NewObject("Page5","Page")

			ENDWITH 

*!*	I add captions to pages 2 to 5 - page one has its caption defined in its class - and add a grid based on the class grdBase on each page

			FOR i = 2 TO 5
				loPage = This.Pages(i)
				WITH loPage
					.Caption = ICASE(i = 2, "Fees", i = 3, "Back", i = 4, "Books", "Uniform")
					.NewObject("grdNames","grdBase")
					.grdNames.Visible = .F.

				ENDWITH 
			ENDFOR 
		ENDPROC 

*!*	I add an EXIT commandbutton to the form which closes it, clears the EVENTS and returns to the command right after READ EVENTS above		
	
	ADD OBJECT cmdExit As CommandButton WITH ;
	   	Width = 60, Height = 30, Left = 480 - 12 - 60, Top = 450 - 12 - 30, Caption = "Exit", Anchor = 12
    	
		PROCEDURE cmdExit.Click()
			ThisForm.Release
			CLEAR Events
		
		ENDPROC
		
*!*	I create three cursors in order to simulate tables
*!*	csrDemo (Students), csrFees (Fees) and csrBooks (Books) - they are normalized
*!*	csrDemo is fed with some data (students) 
*!*    csrBooks and csrFees are empty - they are fed by the user

	PROCEDURE Load()
	
		CREATE CURSOR csrdemo (cCode C(3), cName C(10), cGender C(1), tDTime T)
		
		INSERT INTO csrdemo VALUES ('001','Henry','M',DATETIME() - 6)
		INSERT INTO csrdemo VALUES ('011','Jenny','F',DATETIME() - 5)
		INSERT INTO csrdemo VALUES ('004','Eve','F',DATETIME() - 4)
		INSERT INTO csrdemo VALUES ('005','Lauren','F',DATETIME() - 3)
		INSERT INTO csrdemo VALUES ('009','Bob','M',DATETIME() - 2)
		INSERT INTO csrdemo VALUES ('006','Sharon','F',DATETIME() - 1)
		INSERT INTO csrdemo VALUES ('002','Bobby','X',DATETIME() - 7)
		
		LOCATE 

		CREATE CURSOR csrBooks (cCode C(3), cTitle C(25), tDTime T)

		CREATE CURSOR csrFees (cCode C(3), iFees I, tDTime T)
		
	ENDPROC
	
*!*	Since I am in progamming mode and do not have interactive access to the pages' click event 
*!*	I have to create four methods on the form level to simulate the pages' 2 to 5 click event
*!*	This is done while the form is INITiated

	PROCEDURE Init()
		DODEFAULT()
		
		BINDEVENT(This.pgfNames.Page2, "Click", This, "PTwoClick")
		BINDEVENT(This.pgfNames.Page3, "Click", This, "PThreeClick")
		BINDEVENT(This.pgfNames.Page4, "Click", This, "PFourClick")
		BINDEVENT(This.pgfNames.Page5, "Click", This, "PFiveClick")

	ENDPROC 

*!*	Now follows the code associated with the 4 methods: 
*!*	data is SELECTED from csrDemo and csrFees (PTwoClick) - from csrDemo and csrBooks (PFourClick); 
*!*	PThreeClick and PFiveClick just give visual clues that they are "alive"

	PROCEDURE PTwoClick()
		LOCAL lcName as Character 
		
		WITH ThisForm.pgfNames
			.ActivePage = 2
			.Page2.grdNames.Visible = .T.
			
		ENDWITH 
		
		lcName = csrDemo.cName
		
		SELECT csrDemo.cCode, csrDemo.cName, NVL(iFees, 0), NVL(csrFees.tDTime, DATETIME(2000,01,01)) FROM csrDemo ;
			JOIN csrFees ON csrDemo.cCode = csrFees.cCode ;
			WHERE csrDemo.cName = lcName ;
			INTO CURSOR csrView
		
		IF _Tally > 0
			WITH ThisForm.pgfNames.Page2
				WITH .grdNames
					.ColumnCount = -1
					.RecordSource = "CSRVIEW"

					.Column1.Width = 60
					.Column2.Width = 120
					.Column3.Width = 60
					.Column4.Width = 120
				
					.Column1.Header1.Caption = "ID Code"
					.Column2.Header1.Caption = "Name"
					.Column3.Header1.Caption = "Fee"
					.Column4.Header1.Caption = "Date Time"

				ENDWITH 
				
				.Refresh()

			ENDWITH 
		ELSE
			WITH ThisForm.pgfNames.Page2
				.grdNames.Visible = .F.
				.Refresh()
				
			ENDWITH 		

			= MESSAGEBOX("No data found!", 64, "Paid Fees", 3000)
		
		ENDIF 
	ENDPROC
	
	PROCEDURE PThreeClick()
		WITH ThisForm.pgfNames
			.ActivePage = 3
			.Pages(3).grdNames.Visible = .F.
			.Pages(3).Refresh()
			
		ENDWITH 
		
		= MESSAGEBOX("Under construction!", 64, "Page 3 clicked", 3000)
		
	ENDPROC

	PROCEDURE PFourClick()
		LOCAL lcName as Character 
	
		WITH ThisForm.pgfNames
			.ActivePage = 4
			.Page4.grdNames.Visible = .T.
			
		ENDWITH 
		
		lcName = csrDemo.cName
		
		SELECT csrDemo.cCode, csrDemo.cName, NVL(cTitle, "N.N."), NVL(csrBooks.tDTime, DATETIME(2000,01,01)) FROM csrDemo ;
			JOIN csrBooks ON csrDemo.cCode = csrBooks.cCode ;
			WHERE csrDemo.cName = lcName ;
			INTO CURSOR csrView
			
		IF _Tally > 0
			
			WITH ThisForm.pgfNames.Page4
				WITH .grdNames
					.ColumnCount = -1
					.RecordSource = "CSRVIEW"

					.Column1.Width = 60
					.Column2.Width = 120
					.Column3.Width = 120
					.Column4.Width = 120
				
					.Column1.Header1.Caption = "ID Code"
					.Column2.Header1.Caption = "Name"
					.Column3.Header1.Caption = "Title"
					.Column4.Header1.Caption = "Date Time"
					
				ENDWITH 
				
				.Refresh()

			ENDWITH 	
		ELSE
			WITH ThisForm.pgfNames.Page4
				.grdNames.Visible = .F.
				.Refresh()
				
			ENDWITH 		

			= MESSAGEBOX("No data found!", 64, "Books", 3000)

		ENDIF 
	ENDPROC
			
	PROCEDURE PFiveClick()
		WITH ThisForm.pgfNames
			.ActivePage = 5
			.Pages(5).grdNames.Visible = .F.
			.Pages(5).Refresh()
			
		ENDWITH 

		= MESSAGEBOX("Under construction!", 64, "Page 5 clicked", 3000)
	
	ENDPROC

	
	PROCEDURE Destroy()
		This.cmdExit.Click()
	
	ENDPROC 
ENDDEFINE 

*********

*!*	A grid class is defined; it is instantiated on pages 2 to 5 of the pageframe

DEFINE CLASS grdBase as Grid 
	Top = 12
	Left = 12
	Width = 480 - 24 - 24
	Height = 450 - 24 - 48 - 48
	BackColor = RGB(0, 246, 246)
	RowHeight = 21
	AllowRowSizing = .F.
	HeaderHeight = 21
	AllowHeaderSizing = .F.
	Anchor = 15
	ReadOnly = .T.
	DeleteMark = .F.

ENDDEFINE 

*********

*!*	pagBase is defined; it is instantiated as Page1 of the pageframe above

DEFINE CLASS pagBase as Page

	FontBold = .T.
	Caption = "Students Record"
	Forecolor = RGB(128, 0, 0)
	
*!*	A grid is added to the class pagBase and has csrDemo as RecordSource

	ADD OBJECT grdStudents AS Grid WITH ;
		RecordSource = "csrDemo", ;
		ColumnCount = 3, ;
		Left = 12, ;
		Width = 480 - 48, ;
		Top = 54, ;
		Height = 450 - 24 - 42 - 24 - 24 - 54, ;
		Anchor = 15

		PROCEDURE grdStudents.Init()
			WITH This 
				.Column1.Header1.caption = "ID Number"
				.Column1.Header1.fontname = "Bernard MT Condensed"
				.Column1.Width = 120

				.Column2.Header1.caption = "Name of Student"
				.Column2.Header1.fontname = "Bernard MT Condensed"
				.Column2.Width = 150
			
				.Column3.Header1.caption = "Gender"
				.Column3.Header1.fontname = "Bernard MT Condensed"
				.Column3.Width = 60

			ENDWITH 
		ENDPROC

*!*	You either click on the grid to select a student or you can move through the records - each time the commandbutton's (cmdAddData) caption is refreshed
		
		PROCEDURE grdStudents.AfterRowColChange()
			LPARAMETERS nColIndex

			This.Parent.cmdAddData.Refresh()

		ENDPROC 

*!*	A combox with fixed values is added to the class pagBase

	ADD OBJECT cboSFBBU AS combobox WITH ; && 
		Height = 24, ;
		Left = 12, ;
		Top = 12, ;
		Width = 120, ;
		RowSourceType = 1, ;
		RowSource = "\<School Fees,\<Back,\<Books,\<Uniform"
		
*!*	You click on an item of the combox to enable and refresh the cmdAddData

		PROCEDURE cboSFBBU.click()

			WITH This.Parent.cmdAddData
				.Enabled = .T.
				.Refresh()

			ENDWITH 		
		ENDPROC

*!*	The commandbutton cmdAddData is added to the class pagBase
		
	ADD OBJECT cmdAddData AS CommandButton WITH ;
		TOP = 12, ;
		Left = 144, ;
		Height = 24, ;
		Autosize = .T., ;
		BackColor = RGB(180, 0, 0), ;
		ForeColor = RGB(252, 252, 252), ;
		Enabled = .F.
		
*!*	The caption of cmdAddData is defined awa its ToolTipText

		PROCEDURE cmdAddData.Refresh()
			This.Caption = "Click to add data for " + ALLTRIM(csrDemo.cName) +" in table " + This.Parent.cboSFBBU.Value
			This.ToolTipText = IIF(This.Enabled, "Click to add data", "Select item from combobox to activate this button")

		ENDPROC 

*!*	When clicking cmdAddData Data is added to the cursors depending on the item choosen from the combox and the selected student

		PROCEDURE cmdAddData.Click()

			DO CASE 
				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "School Fees"
					
					INSERT INTO csrFees VALUES (csrDemo.cCode, INT(250 * RAND()), DATETIME())
					
					WITH This
						.Enabled = .F.
						.Refresh()
					ENDWITH 

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Back"
					WAIT WINDOW + "You may add data for " + ALLTRIM(csrDemo.cName) + " into table [Back]" TIMEOUT 2

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Books"

					INSERT INTO csrBooks VALUES (csrDemo.cCode, "BK" + SYS(2015), DATETIME())

					WITH This
						.Enabled = .F.
						.Refresh()
						
					ENDWITH 

				CASE This.Parent.cboSFBBU.List(This.Parent.cboSFBBU.ListIndex,1) = "Uniform"
					WAIT WINDOW + "You may add data for " + ALLTRIM(csrDemo.cName) + " into table [Uniforms]" TIMEOUT 2
					
				OTHERWISE 
					WAIT WINDOW + " No table selected! " TIMEOUT 5
				
			ENDCASE 
		ENDPROC 
ENDDEFINE
********* 

hh

MarK

RE: 'Field' phrase not found

(OP)
Hi Mark I was able to edit the codes.. and I'm so happy to see that gradually i am seeing progress to the project... Thank you so much Mark for the very comprehensive explanation...I'll keep you posted... GodBless....

RE: 'Field' phrase not found

Hi Mandy,

The INIT event is triggered too late for these settings - at the latest they should be in the LOAD event of the form (check picture)



May I kindly invite you to open the following link, e.o. to have a look at the sequence of the VFP EVENTS.

https://flylib.com/books/en/2.920.1/

Although it was written for VFP 6, it might guide you while conceiving and coding your application.

May I also remind you to have a look at the VFP books published by Hentzenwerke

http://hentzenwerke.com/

hth

MarK

RE: 'Field' phrase not found

(OP)
Hi Mark... I'm so happy I am able to edit according to my needs the codes that you have given and suggested... there are things that I still want to add Mark so I am still working on it... I am so happy... thank you so much Mark and everyone who are more than willing to help... God Bless...

from this



to this

RE: 'Field' phrase not found

Hi Mandy,

I'm glad I was able to help. If new issues arise, please don't hesitate to ask.

MarK

RE: 'Field' phrase not found

(OP)
hi Mark...i am almost done with this project... but there are things that I cannot solve... my text boxes are not updating the values after computation even if i put the .refresh() secondly, the numeric values in my text boxes (This.Parent.text13.value = TRANSFORM(transun,'###,###,###.##')) are in the center, how to put it at the rightmost side of the text box Mark? Thanks and God bless...

RE: 'Field' phrase not found

Use The Align, Inputmask and Format Properties of the Textbox.
Textbox.Inputmask = '###,###,###.##' just like the mask you tried with Transform.
And then controlsource should be the transun field.

Chriss

RE: 'Field' phrase not found

Hi Mandy,

Quote:


my text boxes are not updating the values after computation even if i put the .refresh() secondly

Could you please show the code snippet?

MarK

RE: 'Field' phrase not found

Hi Mandy,

Quote:


the numeric values in my text boxes (This.Parent.text13.value = TRANSFORM(transun,'###,###,###.##'))

Why do you switch from NUMERIC to CHARACTER? What field type is the controlsource of text13?

hth

MarK

RE: 'Field' phrase not found

(OP)
Hi Chris & Mark!!! The input mask solve the problem!!! Thank you...bigsmile Mark i was trying to align the values to the right thinking that converting it to character could align it to the right... but i was wrong.. thanks for you guidance..... Thank you again....God Bless.... bigsmilebigsmile

RE: 'Field' phrase not found

Hi Mandy,

Quote:


that converting it to character could align it to the right

C values (Character, Memo, ...) are by default LEFT aligned whereas N (Numeric, Integer, Float ...) values are RIGHT aligned - please have a look at the different field types in the Help File.

hth

MarK

RE: 'Field' phrase not found

(OP)
Hi Mark... may i ask help on how to add textboxes on page 6 which i am able to add as "others"? i am confuse where to put a class for "others".... Thanks in advance Mark...

RE: 'Field' phrase not found

Hi Mandy

Quote:


how to add textboxes on page 6 which i am able to add as "others"?

You may try something like below. Nevertheless I hope you definitely use the project manager to visually put all the controls with their PEMs

CODE -->

PROCEDURE pgfNames.Init()
			LOCAL loPage as Object
			
			WITH This
				.NewObject("Page1","pagBase")
				.NewObject("Page2","Page")
				.NewObject("Page3","Page")
				.NewObject("Page4","Page")
				.NewObject("Page5","Page")
                                .NewObject("Page6","Page")
			ENDWITH 

*!*	I add captions to pages 2 to 6 - page one has its caption defined in its class - and add a grid based on the class grdBase on each page

			FOR i = 2 TO 6
				loPage = This.Pages(i)
				WITH loPage
					.Caption = ICASE(i = 2, "Fees", i = 3, "Back", i = 4, "Books", i = 5, "Uniform", "Others")
                                        If i <= 5
					     .NewObject("grdNames","grdBase")
					     .grdNames.Visible = .F.
                                        Endif
                                        If i = 6 && NOT tested
                                             .NewObject("txtSTName","TextBox")
                                             With .txtSTName
                                                          .Visible = .T.
                                                          .Left = 
                                                          .Top =  
                                                           ....
                                            EndWith
                                        Endif 
				ENDWITH 
			ENDFOR 
		ENDPROC 

hth

MarK

RE: 'Field' phrase not found

(OP)
Thank you so much Mark!!!! it worked!!!!!! My project is almost done.... Just another question, i have a put a commandbutton, where am i going to insert the procedure for the command button? Thanks....

.NewObject("txtSTid","TextBox")
With .txtSTid
.Visible = .T.
.Left = 194
.Top = 25
ENDWITH

.NewObject("txtST","editbox")
With .txtST
.Visible = .T.
.Left = 494
.Top = 25
.height = 104
.width = 102
ENDWITH

.NewObject("txtSTcmd","commandbutton")
With .txtSTcd
.Visible = .T.
.Left = 494
.Top = 95
.height = 104
.width = 102
ENDWITH

RE: 'Field' phrase not found

Hi Mandy

Quote:


where am i going to insert the procedure for the command button?

You'll put it into the cmdButton.Click() event.

Mandy, please adopt the Best Practice - also called the Hungarian - notation in order to make your code better readable and less ambiguous - I already gave you the link to the Programmer's Guide (see one of my previous posts)

CODE -->

.NewObject("txtSTid","TextBox")
With .txtSTid
.Visible = .T.
.Left = 194
.Top = 25
ENDWITH

.NewObject("txtST","editbox")
.NewObject("edtNameIt","EditBox")
With .edtNameIt
.Visible = .T.
.Left = 494
.Top = 25
.height = 104
.width = 102
ENDWITH

.NewObject("txtSTcmd","commandbutton")
.NewObject("cmdNameIt","CommandButton")
With .cmdNameIt
.Visible = .T.
.Left = 494
.Top = 95
.height = 104
.width = 102
ENDWITH 

hth

MarK

RE: 'Field' phrase not found

(OP)
Thanks Mark.....I've changed it to more readable and identifiable names.... I Hope i'm learning... bigsmilebigsmile

.NewObject("LblGrdlvl","Label")
With .LblGrdlvl
.Visible = .T.
.Left = 157
.Top = 68
.Width = 120
.Caption = "Grade:"
ENDWITH

.NewObject("txtGrdLvl","Combobox")
With .txtGrdLvl
.Visible = .T.
.Left = 200
.Top = 65
.Width = 120
.RowSourceType = 1
.RowSource = "\<A,\<7,\<8,\<9"
ENDWITH

.NewObject("LblName","Label")
With .LblName
.Visible = .T.
.Left = 157
.Top = 95
.Width = 120
.Caption = "Name:"

ENDWITH

.NewObject("txtSTName","TextBox")
With .txtSTName
.Visible = .T.
.Left = 200
.Top = 95
.Width = 220
ENDWITH

.NewObject("LblCtr","Label")
With .LblCtr
.Visible = .T.
.Left = 148
.Top = 125
.Width = 120
.Caption = "Counter:"

ENDWITH

.NewObject("txtCtr","TextBox")
With .txtCtr
.Visible = .T.
.Left = 200
.Top = 125
.Width = 120
ENDWITH

.NewObject("LblMssg","Label")
With .LblMssg
.Visible = .T.
.Left = 143
.Top = 155
.Width = 120
.Caption = "Message:"

ENDWITH

.NewObject("edtMessage","editbox")
With .EdtMessage
.Visible = .T.
.Left = 200
.Top = 155
.height = 104
.width = 220
ENDWITH

.NewObject("cmdSend","Commandbutton")
With .cmdSend
.Visible = .T.
.Left = 480
.Top = 230
.height = 27
.width = 102
.Caption = "Send"

ENDWITH

ENDIF
ENDWITH

RE: 'Field' phrase not found

Hi Mandy,

Almost perfect! glasses

CODE -->

.NewObject("LblGrdlvl","Label")
With .LblGrdlvl
.Visible = .T.
.Left = 157
.Top = 68
.Width = 120
.Caption = "Grade:"
ENDWITH

.NewObject("txtGrdLvl","Combobox") && ComboBox usually takes cbo as prefix
.NewObject("cboGrdLvl","Combobox")
With .cboGrdLvl
.Visible = .T.
.Left = 200
.Top = 65
.Width = 120
.RowSourceType = 1
.RowSource = "\<A,\<7,\<8,\<9"
ENDWITH

.NewObject("LblName","Label")
With .LblName
.Visible = .T.
.Left = 157
.Top = 95
.Width = 120
.Caption = "Name:"

ENDWITH

.NewObject("txtSTName","TextBox")
With .txtSTName
.Visible = .T.
.Left = 200
.Top = 95
.Width = 220
ENDWITH

.NewObject("LblCtr","Label")
With .LblCtr
.Visible = .T.
.Left = 148
.Top = 125
.Width = 120
.Caption = "Counter:"

ENDWITH

.NewObject("txtCtr","TextBox")
With .txtCtr
.Visible = .T.
.Left = 200
.Top = 125
.Width = 120
ENDWITH

.NewObject("LblMssg","Label")
With .LblMssg
.Visible = .T.
.Left = 143
.Top = 155
.Width = 120
.Caption = "Message:"

ENDWITH

.NewObject("edtMessage","editbox")
With .EdtMessage
.Visible = .T.
.Left = 200
.Top = 155
.height = 104
.width = 220
ENDWITH

.NewObject("cmdSend","Commandbutton")
With .cmdSend
.Visible = .T.
.Left = 480
.Top = 230
.height = 27
.width = 102
.Caption = "Send"

ENDWITH

ENDIF
ENDWITH && where are they comming from? 

hth

MarK

RE: 'Field' phrase not found

(OP)
hi mark... My project is up and running, we are already using it... but there is one problem i am encountering and i cannot solve all by myself... may i ask help again... everytime procedure is finished in page 6, the contents in the cursor is no longer right and the combobox does seem to perform the codes... How to refresh the whole and the pages? thanks Mark....

RE: 'Field' phrase not found

Hi Mandy,

Could you please post that code snippet.

hth

MarK

RE: 'Field' phrase not found

(OP)
I have added page 6 Mark... but everytime CmdSend is performed, Page 1 to page 5 does not work anymore... it does not show names anymore in the grid... but if page six and CmdSend is not clicked and performed, everything works well for page 1 to page 6...Thanks Mark...

DEFINE CLASS pagSndSms as page
Top = 12
Left = 20
Width = 690 - 24 - 24
Height = 350 - 24 - 48 - 48
RowHeight = 22
AllowRowSizing = .F.
HeaderHeight = 31
AllowHeaderSizing = .F.
Anchor = 15

ADD OBJECT Label1 as label WITH;
Visible = .T.,;
Left = 157,;
Top = 53,;
Width = 120,;
Caption = "Grade:"

ADD OBJECT cboGrdLvl as Combobox with; && Grade
Visible = .T.,;
Left = 200,;
Top = 50,;
Width = 70,;
RowSourceType = 1,;
RowSource = "\<A,\<7,\<8,\<9,\<10,\<11,\<12"

ADD OBJECT Label2 as label WITH;
Visible = .T.,;
Left = 157,;
Top = 80,;
width = 120,;
Caption = "Name:"

ADD OBJECT text1 as TextBox WITH; && Name
Visible = .T.,;
Left = 200,;
Top = 80,;
Width = 240

ADD OBJECT Label3 as label WITH;
Visible = .T.,;
Left = 132,;
Top = 110,;
Width = 120,;
Caption = "Mobile No.:"

ADD OBJECT Label4 as label WITH;
Visible = .T.,;
Left = 333,;
Top = 110,;
Width = 120,;
Caption = "Counter:"

ADD OBJECT Text2 as TextBox WITH; && Mobile No.
Visible = .T.,;
Left = 200,;
Top = 110,;
Width = 120

ADD OBJECT Text3 as TextBox WITH; && counter
Visible = .T.,;
Left = 395,;
Top = 110,;
Width = 45

ADD OBJECT CmdSend as Commandbutton WITH;
Visible = .T.,;
Left = 480,;
Top = 230,;
height = 27,;
width = 102,;
Caption = "Send"





PROCEDURE CmdSend.click()

SELECT 1
INDEX on grade TO gradex

mctr = 0

scanner = ALLTRIM(UPPER(this.Parent.cboGrdLvl.value))

SCAN NOOPTIMIZE FOR scanner = ALLTRIM(tsulat.grade)

this.parent.text1.value = TRIM(tsulat.sname) + ", " + TRIM(tsulat.fname)
this.Parent.text2.value = TRIM(tsulat.mobile)

*Computations ----------------------------------------------

dyus = 0
paytuit = 0
buks = 0
devisor = 0

TRANSSF = 0
TRANSBA = 0
TRANSBO = 0
TRANSUN = 0

devide = SUBSTR(DTOC(DATE()),1,2)

IF devide = "09"
devisor = 9
ENDIF

IF devide = "10"
devisor = 8
ENDIF

IF devide = "11"
devisor = 7
ENDIF

IF devide = "12"
devisor = 6
ENDIF

IF devide = "01"
devisor = 5
ENDIF

IF devide = "02"
devisor = 4
ENDIF

IF devide = "03"
devisor = 3
ENDIF

IF devide = "04"
devisor = 2
ENDIF

IF devide = "05"
devisor = 1
ENDIF

SELECT 3

iden = transtype

SCAN

DO case

CASE iden = "SF"

TRANSSF = TRANSSF + TRANS.transamt

CASE IDEN = "BA"

TRANSBA = TRANSBA + TRANS.transamt

CASE IDEN = "BO"

TRANSBO = TRANSBO + TRANS.transamt

CASE IDEN = "UN"
TRANSUN = TRANSUN + TRANS.transamt

ENDCASE

ENDSCAN

*Computations ----------------------------------------------

twesyon = ((tsulat.tuition - TRANSSF)/devisor)
hapbuks = ((tsulat.books - TRANSBO)/devisor)
hapback = ((tsulat.baccount - TRANSBA)/devisor)
hapuni = ((tsulat.uniform - TRANSUN)/devisor)
dyus = twesyon + hapbuks + hapback + hapuni
todyus = (tsulat.tuition + tsulat.baccount + tsulat.books + tsulat.uniform) - (transsf + transba + transbo + transun)


*Recording or Replacemnt ----------------------------------

REPLACE tsulat.pbaccnt WITH transba
REPLACE tsulat.ptuition WITH transsf
REPLACE tsulat.puniform WITH transun
REPLACE tsulat.pbooks WITH transbo

mctr = mctr + 1
this.Parent.text3.value = mctr

ENDSCAN

thisform.refresh()


ENDPROC

RE: 'Field' phrase not found

Hi Mandy,

1) You DEFINE a class pagSndSms but there is no ENDDEFINE statement

2) a page does not have these properties

Quote:


RowHeight = 22
AllowRowSizing = .F.
HeaderHeight = 31
AllowHeaderSizing = .F.

3) Where and how did you add the class pagSnsSms to the PageFrame?

4) As to your code

CODE -->

PROCEDURE CmdSend.click()
*!*	you may want to declare the variables e.g LOCAL lcScanner as Character, liMctr as Integer, ...

SELECT 1
INDEX on grade TO gradex

*!*	you have been asked several times not to select a workarea (WA) by number but by its ALIAS()
*!*	even if you index on grade you'll have to make sure that the tag is chosen e.g. SET ORDER TO gradex
*!*	and you'll have to make sure that the order is set back to its former ORDER

mctr = 0

lcScanner= ALLTRIM(UPPER(this.Parent.cboGrdLvl.value))


*!* You don't need neither ALLTRIM() nor UPPER() since the values of cboGrdLvl are constants

SCAN NOOPTIMIZE FOR scanner = ALLTRIM(tsulat.grade)

*!* The scan command has to be reverted
*!* Why the NOOPTIMIZE?

SCAN FOR ALLTRIM(tsulat.grade) = lcScanner

	this.parent.text1.value = TRIM(tsulat.sname) + ", " + TRIM(tsulat.fname)
	this.Parent.text2.value = TRIM(tsulat.mobile)

	*Computations ----------------------------------------------

	dyus = 0
	paytuit = 0
	buks = 0
	devisor = 0 && default value should be different from 0 e.g. 1

	TRANSSF = 0
	TRANSBA = 0
	TRANSBO = 0
	TRANSUN = 0

	devide = SUBSTR(DTOC(DATE()),1,2)
	
*!*		Considering the returned values I assume you look for the month hence ;
lcDevide = TRANSFORM(MONTH(DATE())) - the code below has to reflect the returned values e.g. lcDevide = "9"
	

	IF devide = "09"
	devisor = 9
	ENDIF

	IF devide = "10"
	devisor = 8
	ENDIF

	IF devide = "11"
	devisor = 7
	ENDIF

	IF devide = "12"
	devisor = 6
	ENDIF

	IF devide = "01"
	devisor = 5
	ENDIF

	IF devide = "02"
	devisor = 4
	ENDIF

	IF devide = "03"
	devisor = 3
	ENDIF

	IF devide = "04"
	devisor = 2
	ENDIF

	IF devide = "05"
	devisor = 1
	ENDIF

	SELECT 3

*!*	see above 
		iden = transtype

	SCAN

		DO case

			CASE iden = "SF"

			TRANSSF = TRANSSF + TRANS.transamt

			CASE IDEN = "BA"

			TRANSBA = TRANSBA + TRANS.transamt

			CASE IDEN = "BO"

			TRANSBO = TRANSBO + TRANS.transamt

			CASE IDEN = "UN"
			TRANSUN = TRANSUN + TRANS.transamt

		ENDCASE

	ENDSCAN

*!* You may want to SELECT 1 again although it is not required - just good practice 

	*Computations ----------------------------------------------

	twesyon = ((tsulat.tuition - TRANSSF)/devisor)
	hapbuks = ((tsulat.books - TRANSBO)/devisor)
	hapback = ((tsulat.baccount - TRANSBA)/devisor)
	hapuni = ((tsulat.uniform - TRANSUN)/devisor)
	dyus = twesyon + hapbuks + hapback + hapuni
	todyus = (tsulat.tuition + tsulat.baccount + tsulat.books + tsulat.uniform) - (transsf + transba + transbo + transun)


	*Recording or Replacemnt ----------------------------------

	REPLACE tsulat.pbaccnt WITH transba
	REPLACE tsulat.ptuition WITH transsf
	REPLACE tsulat.puniform WITH transun
	REPLACE tsulat.pbooks WITH transbo

	mctr = mctr + 1
	this.Parent.text3.value = mctr

ENDSCAN

*!*	I assume that your formulas are correct - you might easily check and try your code without them

*!*	you'll also have to make sure that the initial ALIAS() is selected again - otherwise all is in jeopardy

thisform.refresh()


ENDPROC 

hth

MarK

RE: 'Field' phrase not found

I curious as to what happens if the procedure is run in June, July or August.

There is no IF branch to change devisor from zero, so the calculations will fire a divide by zero error won't they?

Regards

Griff
Keep Smileing

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.

RE: 'Field' phrase not found

2
I think this section

CODE

IF devide = "09"
	devisor = 9
	ENDIF

	IF devide = "10"
	devisor = 8
	ENDIF

	IF devide = "11"
	devisor = 7
	ENDIF

	IF devide = "12"
	devisor = 6
	ENDIF

	IF devide = "01"
	devisor = 5
	ENDIF

	IF devide = "02"
	devisor = 4
	ENDIF

	IF devide = "03"
	devisor = 3
	ENDIF

	IF devide = "04"
	devisor = 2
	ENDIF

	IF devide = "05"
	devisor = 1
	ENDIF 

Would/Could be replaced with this:

CODE

IF VAL(DEVIDE) < 6
	DEVISOR = 6-VAL(DEVIDE)
ELSE
	DEVISOR = 18-VAL(DIVIDE)
ENDIF 

or even

CODE

DEVISOR = IIF(VAL(DIVIDE)<6,6,18)-VAL(DIVIDE) 

Regards

Griff
Keep Smileing

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.

RE: 'Field' phrase not found

(OP)
Thank you so much Mark and Griff.... i enjoyed learning from you guys... and i enjoyed debugging and correcting all errors i've made... I'll always keep you updated of the project i am working..... Thank you so much.... God bless...

RE: 'Field' phrase not found

(OP)
Hi Tamar, Chris, Mike, Griff & Mark....and everyone in this forum... I am so happy that my Project is now completely working..... Thank you so much.... God bless you all...

RE: 'Field' phrase not found

Hi Mandy,

Glad to read that you finished this project. Would you mind uploading the zipped code/project to Engineering.com in order to allow us to throw a last glimpse?

hth

MarK

RE: 'Field' phrase not found

(OP)
i went to engineering.com Mark but i dont know where to go... smile

RE: 'Field' phrase not found

Hi Mandy,

On the bottom of THIS page is a link to Engineering.com - you just have to click on "Click here to upload ...", select you zipped file and load it up.

hth

MarK

RE: 'Field' phrase not found

Hi Mandy,

Thank you. Great job. I'm glad it works now.

However you do not use VFP to its full potential. May I reiterate my suggestion and point to the books I mentioned in one of my former threads.

Enjoy VFP.

MarK

RE: 'Field' phrase not found

(OP)
ok, I will Mark... Thanks again...

RE: 'Field' phrase not found

Hi Mandy,

I threw a glimpse at your code. Quite a job. But unfortunately there are some gotchas.

1) You may want to create the tables with all the required indexes in order not to have to (re)index them each time you refer to them. Hence instead of

CODE -->

SELECT 0
USE transaction exclusive ALIAS trans
INDEX on idnum TO tidnumx
SET ORDER TO tidnumx 

you may want to

CODE -->

SELECT 0
USE transaction ORDER tidnumx ALIAS trans exclusive 

or even

USE transaction ORDER tidnumx ALIAS trans exclusive IN 0 

If you then need to open a different index you just SET ORDER TO iNewIndex

CODE -->

LOCAL lcOldOrder AS CHARACTER
lcOldOrder = ORDER()

SET ORDER TO iNewIndex
...
more code
...
SET ORDER TO (lcOldOder) 

2) You hard coded the year in some messages. What is happening to your application after 2021? Furthermore, I didn't find any reference to a (school) year in your code. Aren't the fees due on a yearly/periodical basis? ...

Quote:


"Students' Record 2021"

3) A little bit of math: your computation formula may be shortened. Instead of

CODE -->

devide = SUBSTR(DTOC(DATE()),1,2)
DEVISOR = IIF(VAL(DEVIDE)<6,6,18)-VAL(DEVIDE) 

...

twesyon = ((tsulat.tuition - TRANSSF)/devisor)
hapbuks = ((tsulat.books - TRANSBO)/devisor)
hapback = ((tsulat.baccount - TRANSBA)/devisor)
hapuni = ((tsulat.uniform - TRANSUN)/devisor)
dyus = twesyon + hapbuks + hapback + hapuni
todyus = (tsulat.tuition + tsulat.baccount + tsulat.books + tsulat.uniform) - (transsf + transba + transbo + transun) 

you may want to recode it like below (I assumed that you are checking for the month)

CODE -->

liDevide = Month(DATE())
liDEVISOR = IIF(liDEVIDE < 6, 6, 18) - liDEVIDE

...
twesyon = ((tsulat.tuition - TRANSSF)/devisor)
hapbuks = ((tsulat.books - TRANSBO)/devisor)
hapback = ((tsulat.baccount - TRANSBA)/devisor)
hapuni = ((tsulat.uniform - TRANSUN)/devisor)
dyus = twesyon + hapbuks + hapback + hapuni

lnTodyus = (tsulat.tuition + tsulat.baccount + tsulat.books + tsulat.uniform) - (transsf + transba + transbo + transun)
lnDyus = lnToDyus/liDevisor 

hth

MarK

RE: 'Field' phrase not found

(OP)
Hi Mark I am just so amazed with your suggestions!!! You are so great....! How i wish i could also have that overwhelming programming skills....!! Ok, I will try to understand it well, then try to recode to a shorter one... Thanks again and God Bless...

RE: 'Field' phrase not found

Hi Mandy,

Yesterday it was raining over here in Old Europe and I had some time to have a closer look at your code. Based on my understanding of it, I made some modifications and added a reference to the year. I further assumed that each payment for the School, the Books and the Uniform is done yearly in one and only one transaction (if that's not the case, the code may easily be modified) and that you'll want to keep track of the payments over the years. I also added a picture to the form and to Page2 of the Pageframe - you have the option to choose the one you want. Please be aware that the labels on Page2 are WHITE, hence you need a picture with a darker background.

A picture is also embedded in the EXIT Button - unfortunately I forgot to add the GETPICT() function

I uploaded the PRG to Engineering.com

Enjoy!

MarK

RE: 'Field' phrase not found

(OP)
Hi Mark!!!!!!! I am speechless.....You are so kind and so good!!! What more can i ask?! Thank you so much and God Bless!!! How i wish i could be like you that is so excellent in programming.... Thanks again....bigsmilebigsmilebigsmile

RE: 'Field' phrase not found

(OP)
Hi Mark... I don't know if this is the right thread for my question, but I want to ask if I want to put my databases of this project in a server, can it still be accessed by client computers? will I change the exclusivity of the database? and how will i configure this project to be in networking Mark? May i ask suggestions from you? thanks and God Bless...

RE: 'Field' phrase not found

Hi Mandy,

You may want to start a new thread, since it is a new topic.

The short answer is YES, but ... first you'll have to (re)write your code for shared access with all its requirements. Furthermore
  • what kind of hardware do you have in mind: a NAS, a cloud storage, a client/server architecture?
  • how do you want to access your data (databases, tables, views ...) - locally and/or over the internet?
Depending on your requests the coding and the hardware will vary quite a bit with the corresponding costs.

hth

MarK

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close