Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo update...

Status
Not open for further replies.

hudhwk

Programmer
Jan 28, 2003
80
MX
Hi guys!

I am having a problem with a combo update. I load certain information from a table into a form, but in diference with the text fields which only with storing the table info into it, it is updated and printable. In the combos, the situation is a little different. Although I seek the the field in table, the information is not updated in the combo.

Any idea on how to do this? I don't know if I am clear enough, please let me know if it isn't so.

Thanks a lot in advance.

Daniel Buentello
"Here comes the hawk!
 
Hello Daniel.

>> In the combos, the situation is a little different. Although I seek the the field in table, the information is not updated in the combo. <<

If I understand you correctly, you are saying that your combo boxes update the underlying data (as specified in the ControlSource), but you do not see the selected value in the combo box (the combo box is blank after you select a value).

If this is the case, the problem is that the ControlSource is not a part of the combo box's internal list. Can you give us information on how the combo is set up: RowSource, RowSOurceType, BoundColumn, BoundTo, ControlSource.



Marcia G. Akins
 
Hi Marcia,

Thanks for your response. Sure I can give you info. Here is the code.

set exact on
seek alltrim(thisform.pageframe1.page1.txtFol.text)
set exact off
if found()
thisform.pageframe1.page1.txtFol.enabled=.f.
thisform.pageframe1.page2.enabled=.t.
thisform.pageframe1.page3.enabled=.t.
thisform.pageframe1.page2.txtFol.;
value=thisform.pageframe1.page1.txtFol.text
thisform.pageframe1.page3.txtFol.;
value=thisform.pageframe1.page1.txtFol.text
thisform.pageframe1.page2.txtFol.enabled=.f.
thisform.pageframe1.page3.txtFol.enabled=.f.
thisform.pageframe1.page1.txtfrec.value=mae_cc.frec
thisform.pageframe1.page1.txtfcmb.value=mae_cc.fcmb
*** Here is where I locate the information for the combo, but it doesn't get updated.
seek mae_cc.c_un in c_un
thisform.pageframe1.page1.combo1.refresh <--- Here is the
update of
the info.
Basically I
only do a
refresh.

else
messagebox('Solicitud nueva', 0 + 64,;
'Control de Cambios')
thisform.pageframe1.page2.enabled=.t.
thisform.pageframe1.page3.enabled=.t.
endif

I hope this works for you. Thanks again.
 
hudhwk,

I still don't see where you provide the information that Marcia asked for, chiefly the RowSource, RowSOurceType, BoundColumn, BoundTo, ControlSource of the combobox. Maybe my eyes are just deceiving me. The reason that Marcia asks the question is a valid one as illustrated by the thread I started here:

BLANK COMBOBOX WHEN VALUE NOT IN LIST
thread184-627180

boyd.gif

craig1442@mchsi.com
&quot;Whom computers would destroy, they must first drive mad.&quot; - Anon​
 
Hello Daniel.

>> *** Here is where I locate the information for the combo, but it doesn't get updated.
seek mae_cc.c_un in c_un
thisform.pageframe1.page1.combo1.refresh <<

First of all, if you are going to do a SEEK, in order to be defensive, you really ought to check to see if the value you are looking for is FOUND() <s>.

It seems to me that you have a lot of code here that you do not need. Typically, you use a combo to bind some field in some table (specified by the combo's ControlSource), typically a foreign key value that points to a value that is stored in a lookup table somewhere (specified by its RowSource). If the combo is set up like this, there is no need to SEEK any values in its RowSOurce. You get all this for free.

Anyway, can you tell me how the combo is set up?

ControlSource =
RowSourceType =
RowSource =
BoundColumn =
BoundTo =

If you do this, we can probably help you to solve your problem.



Marcia G. Akins
 

I set up a form with a combobox and grid. I moved the record pointer in the grid and then refreshed. It updated the combo box correctly. Just make sure your Controlsource is set to the table and rowsourcetype is set correctly.

EX:
with combo
.Controlsource="Mytable"
.Rowsourcetype=2 && Alias
.BoundColumn=1 && Column(s) to display
EndWith

 
Im very sorry guys,

I am not programming a combo, basically I'm manipulating it via forms, what you see in the previous code is only an asignation of values from a table into memory, I can guarantee that the info , this way the info I can give you is the following:

ControlSource = (Nothing)
RowSourceType = 6 Fields
RowSource = c_un.des
BoundColumn = 1
BoundTo = .F.

I am not sure if this helps you but here it is. Thanks again for your interest and support.

Sincerely,

Daniel Buentello
"Here comes the hawk!
 
Hi Daniel.

>> ControlSource = (Nothing)
RowSourceType = 6 Fields
RowSource = c_un.des
BoundColumn = 1
BoundTo = .F. <<

In this case, doing the SEEK in c_un should display the appropriate value in the combo (no refresh required. Refresh updates the value of a control from its ControlSource. Since your combo is not a bound control, it is not needed).

If the combo is staying blank after the SEEK, my best guess is that the SEEK is failing for some reaon. What happens if you put in a check for FOUND()?





Marcia G. Akins
 
Hi Marcia,

I checked the parameters you gave me, and found the solution. It was the ControlSource, once I changed it the value just updated correctly.

It's working!!! Thanks a lot guys for all your support, you've always been my right hand to solve all my doubts.

God bless!!!

Sincerely,

Daniel Buentello
"Here comes the hawk!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top