steve4king
IS-IT--Management
I've got an old procedure I'm modifying to better handle non-numeric issues, some of my changes didn't seem to take affect, so I added a couple of messageboxes and found that it is skipping in the middle.. and I can't explain it:
Any ideas?
Thanks
-Stephen
Code:
Do While nCounter <= 2
Select IDTable
cBuffer = Alltr(Str ( (IDTable->&cWhatRef + 1), 12,0))
If nLen < Len(cBuffer ) OR ALLTRIM(CHRTRAN(IDTable->&cWhatRef,"0123456789",""))!=""
MESSAGEBOX("Found Bad ID",0,"cwhatref")
Do Case
Case Upper(cWhatRef)="CUSTNO"
cWhat = "Customer "
SELECT MAX(cust_num) as iNum ;
FROM ( ;
SELECT cust_num ;
FROM cust) A ;
WHERE cust_num < replicate("9", nLen) ;
AND ALLTRIM(CHRTRAN(cust_NUM,"0123456789",""))=="" ;
INTO CURSOR curNewNum
Case Upper(cWhatRef)="CUSPO_NO" && Purchase Order
cWhat = "Purchase Order "
SELECT MAX(PO_NUM) as iNum ;
FROM ( ;
SELECT PO_NUM ;
FROM PURCH_TO ;
UNION ;
SELECT PO_NUM ;
FROM POTOP_HI) A ;
WHERE PO_NUM < replicate("9", nLen) ;
AND ALLTRIM(CHRTRAN(PO_NUM,"0123456789",""))=="" ;
INTO CURSOR curNewNum
Otherwise
cWhat = cWhatRef
Endcase
***************************************************************************
MESSAGEBOX("I see this messagebox",0,"")
MESSAGEBOX("But not this messagebox or anything after this",0,"")
***************************************************************************
MESSAGEBOX("IDTable currently shows " + IDTable->&cWhatRef + " replacing with " + STR(curNewNum.iNum,6,0),0,"trying")
Replace IDTable->&cWhatRef With curNewNum.iNum && this isn't working...
mNextRef = STR(curNewNum.iNum, nLen)
Endif
Replace IDTable->&cWhatRef With IDTable->&cWhatRef + 1
Select _master && (cMaster)
Seek mNextRef
If Found()
If .T.
Fox_Use("werror")
Insert Into werror (Time, Date, Version, clerk, stationid, Descriptio, called) ;
VALUES (Time(), Date(), zVerWin, mClerk, mccTID, ;
"GetNxRef found that " + Upper(cWhatRef) + " " + mNextRef + " already exists!", ;
"GetNxRef found #" + mNextRef + "!")
Use In werror
Select _master
Endif
nCounter = nCounter + 1
Else
Exit
Endif
Enddo
Any ideas?
Thanks
-Stephen