Dear folks

A few weeks back I posted a request: I had a form
where I wanted a COMBO box listing these values
in this order:

VRSystem  VRDescription

 A        Alignment
 B        Brakes
 C        Cooling
 E        Electrical
 F        Fuel
 I        Inspections
 K        Transmission
 L        Labor
 M        Motor/Drive train
 O        Other Miscellaneous
 P        Preventive Maintenance
 Q        LOF
 S        Suspension
 T        Tires
 W        Towing
 X        Exhaust

AND I wanted Q as the default value for all rows.  Claudine
suggested that I use a variable combo box defaulting
the value of the variable to Q.

I just want to report that building on Claudine’s idea, I
was able to get this working correctly, and to share a bit
about what I had to do to make this work.

Since I wanted ONE form for entry AND for editing, here’s
what I had to do:

1.  On the form:

    I set up 2 COMBO boxes, one a VARIBLE Lookup combo box
    for the variable ffVRSYSTEM (component ID ffVRSYSTEM),
    and a second a DB Lookup Combo Box for the column
    VRSYSTEM (component ID VRSYSTEM).

    I wanted to use the VARIABLE combo for data entry and
    the DB combo for data editing.

    The two combo boxes had identical settings for source of
    data, columns displayed, and were placed with the SAME
    Left / Top / Width / Height values, one one top of the
    other.

    In addition, since I wanted the value of the variable to
    be loaded into the column VRSYSTEM, I set up a dummy
    hidden DB Edit control for the column VRSystem, located
    behind the combo boxes, width 0, Read Only,  no tab stop.
    Component ID for this DB edit is cVRSYSTEM.

2.  Calling program:  here are the relevant lines of code:

        SET VAR eVR_FormMode TEXT = NULL *(Form mode)
        SET VAR ffVRSystem TEXT = NULL   *(Combo box for
                                            entry)
        SET VAR eVR_FormMode TEXT = 'Enter'
        -- Default VRSystem to 'Q' so combo box will
        -- default to Q
        SET VAR ffVRSystem = 'Q'
        Enter VehRepr2 CAPTION .eVR_Caption

3.  On after start EEP for the form:

    IF eVR_FormMode = 'Enter' THEN
       -- Enable and make visible the VARIABLE combo box,
       -- disable and make invisible the DB combo box
       PROPERTY ffVRSYSTEM VISIBLE 'TRUE'
       PROPERTY ffVRSYSTEM ENABLED 'TRUE'
       PROPERTY VRSYSTEM VISIBLE 'FALSE'
       PROPERTY VRSYSTEM ENABLED 'FALSE'
    ENDIF

    IF eVR_FormMode = 'Edit' THEN
      -- enable db combo, disable variable combo
      PROPERTY ffVRSYSTEM VISIBLE 'FALSE'
      PROPERTY ffVRSYSTEM ENABLED 'FALSE'
      PROPERTY VRSYSTEM VISIBLE 'TRUE'
      PROPERTY VRSYSTEM ENABLED 'TRUE'
    ENDIF

4.  Created an ON ROW ENTRY EEP for the form.
    The relevant lines of code were:

    IF eVR_FormMode = 'Enter' THEN
      SET VAR ffVRSYSTEM = 'Q'
    ENDIF

    Since the form could be used to enter many rows, for
    each NEW row I had to default the value to Q again;
    otherwise, since it’s a VARIABLE, the combo would
    default to the value of the PREVIOUS row, which is
    NOT what the client wanted.

5.  Created on ON CLICK EEP for the variable combo box,
    ffVRSYSTEM:

    PROPERTY TABLE VehRepair 'EDIT'
    PROPERTY cVRSYSTEM TEXTVALUE .ffVRSYSTEM
    RETURN

    cVRSystem, remember, is a DBEDit control for the column
    VRSYSTEM where I want the value of the variable combo
    box to go.

This works GREAT.  The combo box defaults to Q for row ENTRY,
when editing it shows the value of the column as it now exists.

Thanks to Claudine for pointing me in the right direction and
thanks to Razzak and the dream team for providing us with such
a great set of tools.  It’s FUN to do this stuff.

David Blocker

David Blocker
[EMAIL PROTECTED]
781-784-1919
Fax: 781-784-1860
Cell: 339-206-0261

Reply via email to