Dawn:
Here is a thought:
>>>>>IF vnum1 = .vnum2 THEN
What are the values for vnum1 and vnum2 when you get the error? (use TRACE)
Should you check for null? What is your setting for EQNULL?
Also, although:
DROP tcolcheck
is accepted R:Base syntax, I am not sure it is proper SQL syntax, I always
use:
DROP TABLE tcolcheck
Javier,

Javier Valencia, PE
President
Valencia Technology Group, L.L.C.
14315 S. Twilight Ln, Suite #14
Olathe, Kansas 66062-4578
Office (913)829-0888
Fax (913)649-2904
Cell (913)915-3137
================================================
Attention:
The information contained in this message and or attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material.  Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from all system and destroy all copies.
======================================================

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dawn Oakes
Sent: Friday, September 03, 2004 4:19 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - EDIT using form problem

I have a form that runs fine either in ENTER or EDIT mode from the
database explorer or the R>.  When calling the form from a group bar
menu in another form using ENTER using formname, it's fine also.
However, when I run it using EDIT USING formname, I get an access
violation every time I close the form.  I've narrowed it down to the ON
CLOSE EEP (see below).  If I take out the IF vnum1 = .vnum2 THEN section
up through the ELSE, I don't get the access violation.  (I've also tried
IF vnum1 <> .vnum2 and reversing the logic - it didn't help).  Here's
the eep, the offending section is preceded by >>>>>, any help would be
appreciated.

DELETE ROWS FROM colorformulas WHERE pigment IS NULL AND pigorder IS
NULL
DROP tcolcheck
CREATE TEMP TABLE tcolcheck (tnumcol TEXT 12, tformula TEXT 200)
(I then SET all variables used in cursors to TEXT = NULL)
DECLARE cnumcol CURSOR FOR SELECT DISTINCT numcol FROM colornumbers
ORDER BY numcol
OPEN cnumcol
FETCH cnumcol INTO vnumcol
WHILE SQLCODE <> 100 THEN
  DECLARE c1 CURSOR FOR SELECT numcol, formline FROM formulaview WHERE
numcol = .vnumcol
  OPEN c1
  FETCH c1 INTO vanumcol, vformline
  WHILE SQLCODE <> 100 THEN
    SET VAR vaformline = (.vaformline & .vformline)
    FETCH c1 INTO vanumcol, vformline
  ENDWHILE
  DROP CURSOR c1
  INSERT INTO tcolcheck tnumcol, tformula VALUES .vnumcol, .vaformline
  SET VAR vaformline = NULL
  FETCH cnumcol INTO vnumcol
ENDWHILE
DROP CURSOR cnumcol
SELECT COUNT(tnumcol) INTO vnumcount FROM tcolcheck t1, tcolcheck t2
WHERE t1.tnumcol <> t2.tnumcol AND t1.tformula=t2.tformula
SET VAR vnum1 TEXT = '1'
SET VAR vnum2 TEXT = '1'
IF vnumcount > 1 THEN
  SELECT tnumcol INTO vnum1 FROM tcolcheck t1, tcolcheck t2 WHERE
t1.tnumcol <> t2.tnumcol AND t1.tformula = t2.tformula AND COUNT = 1
  SELECT tnumcol INTO vnum2 FROM tcolcheck t1, tcolcheck t2 WHERE
t1.tnumcol <> t2.tnumcol AND t1.tformula = t2.tformula AND COUNT = 2
ENDIF

>>>>>IF vnum1 = .vnum2 THEN
  DROP tcolcheck
  CLEAR ALL VAR
  RETURN
ELSE

>>>>this section by itself, without the if,then, else works fine.  But I
need the IF, then else!

  SET VAR vmsg = (.vnum2 & 'has the same formula as' & .vnum1 +
(CHAR(013)) + 'It will be deleted')
  PAUSE 2 USING .vmsg CAPTION ERROR icon attention
  DELETE ROWS FROM colornumbers WHERE numcol = .vnum2
  DELETE ROWS FROM colorformulas WHERE numcol = .vnum2
ENDIF
DROP tcolcheck
CLEAR ALL VAR
RETURN

<<attachment: winmail.dat>>

Reply via email to