This is how I approach this issue:
All the following snippet of code is contained within a loop. The users is
prompted weather to add a new record (work order), if "YES" the a new
record is added with default values, dates, look up values, etc. then it is
determined which record was entered last and it is brought out in the edit
mode. After the record is edited and saved the loop is repeated until the
user selects "NO" to adding a new "work order" The commented out lines are
from the old DOS version run on slow computers and were used to let the user
know what was happening.
LABEL start_loop
CLS
DIALOG 'ADD NEW WORK ORDER?' yes_no vcont YES
IF (LUC(.yes_no) EQ 'NO' OR vcont EQ '[Esc]' ) THEN
GOTO getopt -- if not exit loop
ENDIF
-- WRITE 'ADDING NEW RECORD TO WORK ORDER FILE...' AT 25 1 +
-- YELLOW ON RED BLINK
INSERT INTO wo_file (wo_fy, wo_stat, ih_cont, work_type, sub_sys, +
seg_beg, seg_end, rd_name, district, wo_pvmt, mact_code, mact_eq, +
mact_cq,crew_foreman,crew_size,wo_pstart,wo_pend,wo_astart,wo_aend,
+
wcost_labor,wcost_matl,wcost_equip,wo_comments) VALUES(.myyear,'I',
+
'I','S',.vdefsub,' ',' ',' ','0 ','N ' ,' ',0,0,'
',1,.#DATE,.#DATE,.#DATE, +
.#DATE,0.0,0.0,0.0,'None')
SET VAR wono = wo_no in wo_file where count = LAST
-- WRITE '>>> EDIT WORK ORDER ... ' AT 25 1 +
-- YELLOW ON RED BLINK
-- CLS FROM 3
EDIT USING W_wo_form WHERE wo_no = .wono +
AT 100 100 920 640 CAPTION 'RMS - MAINTENANCE MANAGEMENT SYSTEM'
GOTO start_loop
LABEL getopt
Javier Valencia, PE
President
Valencia Technology Group, L.L.C.
14315 S. Twilight Ln., Suite #14
Olathe, KS 66062-4571
(913)829-0888
(913)649-2904 FAX
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Steve Johnson
Sent: Wednesday, November 20, 2002 1:37 AM
To: [EMAIL PROTECTED]
Subject: Auto Number
To All:
I have created a simple application that stores permit data in one
table. Other tables exist as look-up tables to fill in repetitive alpha
data in the input form using numerical codes. The input form has an
autonumber column that generates a sequential id number. On completion of
the last field of the form, pressing the "enter" key obviously brings up a
new blank form with a incremented id number. Works great, especially when
one enters 50 to 100 forms in a single session. The only problem is that
if you entered the form by mistake, the autonumber column increments. Even
though you exit with "discard row" the autonumber remains incremented as
expected. The work around is to remember to exit the last instance of
completing the form with "esc" and "save". Not very elegant, but it works.
Now I am going to guess that it is bad form to bring up a new form
without
asking if you want to enter another form each time. I am sure there is a
better way to control autonumber more effectively. And I want to minimize
the additional keystrokes needed on a repetitive basis to prevent instances
of an unwanted incremented autonumber column. Suggestions?
Steve
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/