Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Field' phrase not found 4

Status
Not open for further replies.

Mandy_crw

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

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

PROCEDURE Load

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

ENDPROC

PROCEDURE Init

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

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

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

SET RELATION TO IDNUM INTO pay

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

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

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

PROCEDURE combo1.click()

SELECT 1

SEEK ALLTRIM(MyDataB.idnum)

IF FOUND()

SELECT 2

this.oGrid2.RecordSource = SPACE(0)

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

this.oGrid3.RecordSource = SPACE(0)

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

this.oGrid4.RecordSource = SPACE(0)

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

this.oGrid5.RecordSource = SPACE(0)

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

ENDIF
 
I 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 [Smile]ing

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

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I 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 [Smile]ing

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

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
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...
 
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...
 
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
 
i went to engineering.com Mark but i dont know where to go... [smile]
 
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
 
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
 
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? ...

"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

...
[s]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[/s]

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

hth

MarK

 
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...
 
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
 
 https://files.engineering.com/getfile.aspx?folder=fb8aa513-437b-41c2-b405-6f30680e620f&file=testphstudents.prg
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....[bigsmile][bigsmile][bigsmile]
 
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...
 
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
[ul]
[li]what kind of hardware do you have in mind: a NAS, a cloud storage, a client/server architecture?[/li]
[li]how do you want to access your data (databases, tables, views ...) - locally and/or over the internet?[/li]
[/ul]

Depending on your requests the coding and the hardware will vary quite a bit with the corresponding costs.

hth

MarK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top