>>To make it easier on the user in making a selection from a combo box, I am displaying a list of employee.nmbr, fname, lame in a dropdown combo box. The employee table is a parent and is ORDERed by nmbr. A child table's fields are displayed in a grid below for the selected employee.
>>
>>Everything goes fine as long as the user either selects an employee from the dropdown combo or types in a valid employee.nmbr in the combo's edit area. However, if the user types in an invalid employee.nmbr in the combo edit area, the display still shows an employee.fname & lname in a label that I have placed just above the grid, to wit:
>>
>>
>>ThisForm.Label5.Caption= ;
>> ALLTRIM(prlink.fname)+" "+ ;
>> ALLTRIM(prlink.lname)
>>
>>
>>EXAMPLE:
>>If '9999' is entered into the combo's edit area, the employee's name from the last indexed record, '9801', is displayed.
>>
>>Thanks in advance for the help, CH.
>
>Firstly, you can prevent typing in text protion by using drop-down list. If it's not a case, then you can reset Label.Caption from Combo.Interactivechange event.
>*** Combo.Interactivechange
>if this.displayvalue != This.value
>thisform.label.caption=""
>else
>thisform.label.caption=ALLTRIM(prlink.fname)+" "+ ;
> ALLTRIM(prlink.lname)
>endif
>
>BTW, you can always provide that fname+lname will appear in text portion of combo itself.
Thanks a lot for the help. Yes, I'm aware of Dropdown List as opposed to Dropdown Combo; however, in this situation, I kind of need to be able to have the Dropdown Combo edit area available. Manipulating the DisplayValue != This.Value didn't seem to work for me in this situation (maybe I was doing something wrong), but it has helped me to know more about the DisplayValue property. I ended up solving this programmatically, as follows:
SELECT Prlink
PUBLIC mvar1
mvar1=This.DisplayValue
SEEK mvar1
IF EOF()=.T.
ThisForm.Combo2.DisplayValue=""
ThisForm.Label5.Caption="Not a Valid Emp No."
SELECT Vac
SET FILTER TO Vac.nmbr=Prlink.nmbr
ThisForm.Grid1.Refresh()
ELSE
ThisForm.Combo2.DisplayValue=Prlink.lname
SELECT Vac
SET FILTER TO Vac.nmbr=Prlink.nmbr
SEEK Prlink.nmbr
IF EOF()=.T.
ThisForm.Label5.Caption= ;
ALLTRIM(prlink.fname)+" "+ ;
ALLTRIM(prlink.lname)+ ;
" - No Vacation Records Found"
ThisForm.Grid1.Refresh()
ELSE
ThisForm.Label5.Caption= ;
ALLTRIM(prlink.fname)+" "+ ;
ALLTRIM(prlink.lname)
GO BOTTOM
ThisForm.Grid1.Refresh()
ENDIF
Chuck Henry