>I've got a combo that's behaving weirdly and I can't figure out what I'm missing. This is in a form I inherited from someone else, to which I've made some changes over time.
>
>The combo is a dropdown list, which is populated from a cursor. The cursor is created in the combo's Requery method. There's some code in the Valid (which I moved there from InteractiveChange).
>
>The problem is that after making a selection, the combo box is blank, DisplayValue is empty, and the record pointer for the cursor has moved to the last record. Oddly, though, Value still contains the right value.
>
>I've used Event Tracking and Coverage to see what's running, and the change is happening after the end of the Valid and before the beginning of the When, but no code is running there.
>
>Here's the definition of the combo:
>
>
> ADD OBJECT cbonumberdisplay AS ravicbo WITH ;
> FontName = "Tahoma", ;
> FontSize = 8, ;
> BoundColumn = 2, ;
> RowSourceType = 2, ;
> RowSource = "ValidClinicNumbers", ;
> ControlSource = "ThisForm.iClinicID", ;
> Height = 24, ;
> Left = 505, ;
> Style = 2, ;
> TabIndex = 1, ;
> Top = 0, ;
> Width = 100, ;
> BoundTo = .T., ;
> Name = "cboNumberDisplay"
>
>
>Here's all the code for the combo (with my various DEBUGOUTs removed):
>
>
> PROCEDURE cbonumberdisplay.Valid
> mDisplayAppClinicNumber = ValidClinicNumbers.Clnc_Num
> IF EMPTY(mDisplayAppClinicNumber)
> mDisplayAppClinicNumber = transform(0, "@L 999")
> ENDIF
> thisform.DisplayAppClinicNumber.Refresh()
>
> ENDPROC
>
>
> PROCEDURE cbonumberdisplay.Init
> This.Requery()
> ENDPROC
>
>
> PROCEDURE cbonumberdisplay.Requery
> * Modified 1-December-2005 by TEG
> * Changed RowSourceType and move this code here.
>
> * Get data
> SELECT Clnc_Num, iClinicID as ClinicNum FROM Clinic INTO CURSOR ValidClinicNumbers nofilter
> ENDPROC
>
>
>The only other line in the whole form that addresses this control is in the form's Init:
>
>
>This.cboNumberDisplay.Value = goApp.iClinic
>
>
>Anybody have any suggestions?
>
>Tamar
Tamar,
Can you move the re-creating method to a separate method of the form and unbind the combo before re-creating the cursor? E.g.
combo.RowSource=''
recreate the cursor
combo.RowSource = 'myCursor'
If it's not broken, fix it until it is.
My Blog