I've changed my code and now I set the DisplayValue. It works, but still I'm perplexed why the value doesn't work. And it doesn't work on the second page...
>>Hi everybody,
>>
>>I can not understand what I'm doing wrong and why my combobox doesn't want to behave.
>>
>>I have a form with a pageframe. On the first page I have a combobox to select a carrier for editting and also a new button. When I press New button, added carrier information, I obviously need to add this newly added carrier to my combo and I want to position my combo on this new value.
>>
>>Here is the code in GetAllCarriers method which is executed in the postsavehook of the form (e.g. when the record was already saved in the table):
>>
>>
>>with this
>> if .lGetAllCarriers
>> .cboCarriers.rowsource = ''
>> thisform.Carriers_biz1.lRequeryAllCarriers = .t.
>>
>> .lGetAllCarriers = .f.
>>
>> .cboCarriers.rowsourcetype = 2
>> .cboCarriers.rowsource = 'crsCarriers_All'
>> .cboCarriers.Requery()
>>
>> if not xEmpty(thisform.cSelected_Carriers_pk)
>> .cboCarriers.value = thisform.cSelected_Carriers_pk
>> endif
>> endif
>>
>>endwith
>>
>>The thisform.Carriers_biz1.lRequeryAllCarriers = .t. triggers the assign method of this biz object, which requeries the corresponding cursor addapter. After it's done I have the newly added record in the list, but it's not selected and the display value is still empty.
>>
>>Do you know what could be wrong here?
>>
>>Thanks a lot in advance.
>
>.cbocarries.listindex=number of position of new carrier
>
>obviously, you will have to calculate the list position if new carrier is not added to the bottom.
If it's not broken, fix it until it is.
My Blog