Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with Application Crashing
Message
 
To
03/05/2004 00:50:10
Randy Wessels
Screentek Business Solutions, Llc.
Phoenix, Arizona, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00900288
Message ID:
00900635
Views:
11
Hi Randy,
As I look on to your code, I found out that there is no termsdescrip(1,2). Try termsdescrip(1,1) where it appears that you have initialize thru your array..

thisform.dueby = DATE()+termsdescrip(1,2)==> if this a character Value, you used Val() function or change DATE() TO DTOC(DATE())(This is depends what type of value your out put is), There is and error handler function built in to VFP.. or by calling the command "On Error do your error handler routine.."


THISFORM.combo1changed = ALLTRIM(combocomp.custno)!=ALLTRIM(THISFORM.curcustno)
THISFORM.givecustno = ALLTRIM(combocomp.custno)


SELECT * FROM customers INTO CURSOR cust_view WHERE custno = combocomp.custno

I think you can put this way for your combo box for your Customer selection under your form Init event...

Thisform.combo1.rowsource = "Alltr(Customers.custno,custname)"
Thisform.combo1.rowsourcetype = 6
Put custname if this is a variable for your customer names..


I stated in a previuos email (that was met with several suggestions), that I recently purchased a legacy application. One thing that I am finding out is that in many places, the program will give an error message and basically crash out. This is a two part question.

First, the error box that I get is titled E-Trap 2000. It gives a date (sort of 2.2004.511) then an error message (in this case program termsdescrip.prg does not exist), then what looks like the last select executed (this part doesn't look like it is part of what is causing the error), then an error number, file, and line number. Is this part of foxpro, or did someone program this into the application as part of an error trapping routine?

Secondly, here is one of the crashes that I am getting. To select a customer for an order, you click a combo box and select a customer in the list. If you select a customer a SECOND time, you get the error. I can't figure out why. Here is the code behind the click event:

THISFORM.combo1changed = ALLTRIM(combocomp.custno)!=ALLTRIM(THISFORM.curcustno)
THISFORM.givecustno = ALLTRIM(combocomp.custno)


SELECT * FROM customers INTO CURSOR cust_view WHERE custno = combocomp.custno
IF _TALLY != 0

SELECT * FROM citytaxes INTO CURSOR tempcitytaxes WHERE city = cust_view.city
IF _TALLY = 0
MESSAGEBOX('A tax rate for this city is undefined.')
ENDIF
THISFORM.citytax = tempcitytaxes.citytax
SELECT * FROM countytaxes INTO CURSOR tempcountytaxes WHERE county=cust_view.county
IF _TALLY = 0
MESSAGEBOX('A tax rate for this county is undefined.')
ENDIF
THISFORM.countytax = tempcountytaxes.countytax
SELECT * FROM statetaxes INTO CURSOR tempstatetaxes WHERE state = cust_view.state
IF _TALLY = 0
MESSAGEBOX('A tax rate for this state is undefined.')
ENDIF
THISFORM.statetax = tempstatetaxes.statetax
THISFORM.pageframe1.page1.spinner2.VALUE = THISFORM.citytax + THISFORM.countytax + THISFORM.statetax
THISFORM.currenttaxrate = THISFORM.citytax + THISFORM.countytax + THISFORM.statetax
*!* thisform.pageframe1.page1.spinner2.value = cust_view.citytax + cust_view.countytax + cust_view.statetax
*!* thisform.currenttaxrate = cust_view.citytax + cust_view.countytax + cust_view.statetax
ENDIF

IF THISFORM.combo1changed = .T. .AND. !EMPTY(THIS.VALUE)
TABLEREVERT(.T.,'shipview')
THISFORM.checkedlimit = .F.
IF THISFORM.tookdeposit
THISFORM.givebackdeposit(ALLTRIM(THISFORM.curcustno),THISFORM.lastdeposit)
ENDIF

IF !EMPTY(THIS.VALUE)
THISFORM.checklimit(combocomp.custno,combocomp.balance)
ENDIF


THISFORM.curcustno = ALLTRIM(combocomp.custno)
THISFORM.checkdeposit(combocomp.custno,combocomp.deposit)

curcustno = ALLTRIM(combocomp.custno)
WITH THISFORM.pageframe1.page1
.text1.VALUE = ''
.text3.VALUE = ''
.text5.VALUE = ''

.text2.VALUE = 0.0000
.text4.VALUE = 0.0000
.text6.VALUE = 0.0000

IF !EMPTY(combocomp.salesmn)
.text1.VALUE = combocomp.salesmn
ENDIF
IF !EMPTY(combocomp.salesmn2)
.text3.VALUE = combocomp.salesmn2
ENDIF
IF !EMPTY(combocomp.salesmn3)
.text5.VALUE = combocomp.salesmn3
ENDIF

*!* .check1.VALUE = .F.
*!* .check2.VALUE = .F.
*!* .check3.VALUE = .F.
.check1.ENABLED = .T.
.check2.ENABLED = .T.
.check3.ENABLED = .T.


.combo1.VALUE = combocomp.company
.combo2.VALUE = combocomp.custno
.address11.VALUE = combocomp.address1
.address21.VALUE = combocomp.address2
.city1.VALUE = combocomp.city
.state1.VALUE = combocomp.state
.zip1.VALUE = combocomp.zip
.contact1.VALUE = combocomp.contact
.txtphone.VALUE = combocomp.c1phone
.txtcphone.VALUE = combocomp.c1fax
.emailaddress.VALUE = combocomp.c1email

.txtfob.VALUE = acomp.fob
ENDWITH
THISFORM.checkreps

SELE DESCRIPT,net_due_by FROM terms INTO ARRAY termsdescrip WHERE terms.terms = combocomp.terms
WITH THISFORM.pageframe1.page1
.text7.VALUE = combocomp.balance
.text8.VALUE = combocomp.lastpay
.text9.VALUE = combocomp.lastdate
.text10.VALUE = combocomp.limit
.txtshipvia.VALUE = combocomp.ship_via
.spinner1.VALUE = combocomp.terms
.txtterms.VALUE = termsdescrip(1,1)
.spinner3.VALUE = combocomp.disc
ENDWITH

THISFORM.checkreps

SELE neworders

THISFORM.pageframe1.page2.ENABLED = .T.


REQUERY('shipview')
THISFORM.pageframe1.page1.grdshipto.REFRESH
SELECT net_due_by FROM terms INTO CURSOR termscursor WHERE terms = combocomp.terms
THISFORM.pageframe1.page1.paydate1.VALUE = DATE()+termscursor.net_due_by
SELE * FROM namedrop INTO CURSOR ndrop ORDER BY namedrop WHERE ALLTRIM(custno) == ALLTRIM(neworders.custno)
SELE neworders
ELSE
THISFORM.curcustno = ALLTRIM(combocomp.custno)
ENDIF


thisform.dueby = DATE()+termsdescrip(1,2)

SELECT invno, ordnum,custno,invdate,total FROM postedinvoices INTO CURSOR subsetByCust ;
WHERE custno = combocomp.custno

THISFORM.pageframe1.page1.combo3.ENABLED = .T.
THISFORM.pageframe1.page1.command1.ENABLED = .T.
THISFORM.pageframe1.page1.combo3.ROWSOURCE = 'subsetByCust'

***** end of code *****

The line it is telling me is causing problems is line 118:

thisform.dueby = DATE()+termsdescrip(1,2)


Actually one more question, how do I display line numbers in the editor?

Thanks and sorry for the long post!
Jojo R. dela Cuesta, B.Sc.
eConsultant, Programmer
Dalplus Technologies
http://www.dalplus.com
Previous
Reply
Map
View

Click here to load this message in the networking platform