John:
This is how I do it:
I have a form with one to many tables, i.e. for each work order-procedure
there can be many employees assigned to it
When I want to insert a new employee I sue the followingpartial code code:

-- Here I select an employee

CHOOSE vsel FROM #VALUES FOR +
(LJS(slot_no, 8) & LJS(emp_class, 5) & LJS(emp_sname, 20)) +
FROM emp_file +
UNION SELECT (CHAR(26) & 'Add New Employee...') FROM orgfile +
ORDER BY 1 ASC +
TITLE 'Employee List' CAPTION 'Select Employee...' LINES 10 FORMATTED
IF ( SGET(.vsel,1,1) = CHAR(26) ) THEN
  EDIT USING emp_form ORDER BY slot_no ASC
  GOTO beg_of_eep
ENDIF
IF (vsel = '[ESC]') THEN
  RETURN
ENDIF
SET VAR vslot_no = ( STRIM(SGET(.vsel,9,1)) )

-- Here I get imformation for that employee

SELECT emp_sname, emp_class, hcost_reg, hcost_ot, fica_mult +
INTO vemp_name, vemp_class, vhcost_reg, vhcost_ot, vfica_mult +
FROM emp_file WHERE slot_no = .vslot_no

-- Here I insert the entire record

INSERT INTO fwo_proc_labor  +
(fwo_no,proc_code,slot_no,emp_name,emp_class,fwo_labor_date, +
hr_reg,hr_ot,hr_2times, hcost_reg, hcost_ot, fica_mult) +
VALUES(.fwono, .vproc_code, .vslot_no, .vemp_name, .vemp_class, .#DATE, 0,
0, 0, .vhcost_reg, .vhcost_ot, .vfica_mult)
PROPERTY TABLE fwo_proc_labor 'REFRESH'
PROPERTY TABLE fwo_proc_labor 'LAST'
SKIP TO hr_reg

This will put a new record on the screen with the employee name
classification and hourly rates that can be edited.

If I want to modify this record on entry to the Slot Number (employee ID)
field, I have the following EEP:

SET VAR vold_slot_no = .vslot_no
SET VAR vnew_slot_no = NULL
RETURN

This is the on field exit EEP:

    SAVEROW
-- Compare the value of slot number on entry vs exit form the field, if it
is different slot_no has changed
-- and the information will be collected

    SET VAR vnew_slot_no = .vslot_no
    IF ( vnew_slot_no <> .vold_slot_no ) THEN
      PAUSE 2 USING 'Value has changed' +
      CAPTION 'Status Message' icon confirm
-- collect information for new employee
      SELECT emp_sname, emp_class, hcost_reg, hcost_ot, fica_mult +
      INTO vemp_name, vemp_class, vhcost_reg, vhcost_ot, vfica_mult +
      FROM emp_file WHERE slot_no = .vslot_no

-- Update current record

      UPDATE fwo_proc_labor SET +
      emp_name = .vemp_name, +
      emp_class = .vemp_class, +
      hcost_reg = .vhcost_reg, +
      hcost_ot = .vhcost_ot, +
      fica_mult = .vfica_mult +
      WHERE fwo_no = .fwono AND proc_code = .vproc_code AND +
      slot_no = .vnew_slot_no
      SET VAR vold_slot_no = NULL
      RECALC
      PROPERTY TABLE fwo_proc_labor 'REFRESH'
      RETURN

Note that the work order number and procedure code (fwono, vproc_code) are
pre-defined.

This should give you an idea of how to collect lookup information and place
it into editable fields.
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 John Docherty
Sent: Monday, December 13, 2004 5:55 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - Updating Column Values From Variables in a Form

The answer to this question is presumably obvious, but any assistance would
be appreciated.

I have a form SC, using a table SCHED, with a DB Lookup ComboBox which
returns a description, DE from a RATES table into a column DE in SCHED. The
rates table also contains another two columns, ULAB and UMATL which I
extract into two variables using the ON Click EEP. What I want to do is to
update the values of ULAB and UMATL in the SCHED table, while the row is
still on the form, so that the user has the ability to edit these.

Presumably this is straightforward but unfortunately I cannot sort out how
to achieve this. (An update from the EEP does not work, with the resource
required not being available.)  If there was a way for a DB Lookup Combobox
to assign more than one column from the lookup table to columns in the form
table that would be very useful.

Thank you.

Regards,

John Docherty

Professional Building Services Limited
P O Box 8601,
Christchurch.
New Zealand.

ph: 64-3-3480-873
fx:   64-3-3483-628
em:[EMAIL PROTECTED]


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.290 / Virus Database: 265.5.2 - Release Date: 13/12/2004

Reply via email to