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

2021-04-25_3_mbcquf.png
 
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)

Screenshot_2021-04-25_095840_lditbe.png


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

[link ][/url]

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

[link ][/url]

hth

MarK
 
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

2021-04-27_5_kowial.png


to this

2021-04-27_3_fbfzxl.png
 
Hi Mandy,

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

MarK
 
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...
 
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
 
Hi Mandy,

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
 
Hi Mandy,

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
 
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.... [bigsmile][bigsmile]
 
Hi Mandy,

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

 
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...
 
Hi Mandy

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

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

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

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

hth

MarK
 
Thanks Mark.....I've changed it to more readable and identifiable names.... I Hope i'm learning... [bigsmile][bigsmile]

.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
 
Hi Mandy,

Almost perfect! [glasses]

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

[s].NewObject("txtGrdLvl","Combobox")[/s] && 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

[s]ENDIF
ENDWITH[/s] && where are they comming from?

hth

MarK
 
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....
 
Hi Mandy,

Could you please post that code snippet.

hth

MarK
 
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
 
Hi Mandy,

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

2) a page does not have these properties

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()
[highlight #FCE94F]*!*	you may want to declare the variables e.g LOCAL lcScanner as Character, liMctr as Integer, ...
[/highlight]
[highlight #FCE94F]SELECT 1
INDEX on grade TO gradex[/highlight]

[highlight #FCE94F]*!*	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[/highlight]

mctr = 0

[highlight #FCE94F]lcScanner= ALLTRIM(UPPER(this.Parent.cboGrdLvl.value))
[/highlight]

[highlight #FCE94F]*!* You don't need neither ALLTRIM() nor UPPER() since the values of cboGrdLvl are constants[/highlight]

[highlight #FCE94F][s]SCAN NOOPTIMIZE FOR scanner = ALLTRIM(tsulat.grade)[/s][/highlight]

[highlight #FCE94F]*!* The scan command has to be reverted
*!* Why the NOOPTIMIZE?[/highlight]

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
	[highlight #FCE94F]devisor = 0 && default value should be different from 0 e.g. 1
[/highlight]
	TRANSSF = 0
	TRANSBA = 0
	TRANSBO = 0
	TRANSUN = 0

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

[highlight #FCE94F]	IF devide = "09"
[/highlight]	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

	[highlight #FCE94F]SELECT 3[/highlight]

[highlight #FCE94F]*!*	see above [/highlight]
		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
[highlight #FCE94F]
*!* You may want to SELECT 1 again although it is not required - just good practice [/highlight]

	*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

[highlight #FCE94F]*!*	I assume that your formulas are correct - you might easily check and try your code without them

[highlight #F57900]*!*	you'll also have to make sure that the initial ALIAS() is selected again - otherwise all is in jeopardy[/highlight]
[/highlight]
thisform.refresh()


ENDPROC

hth

MarK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top