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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox controlsource rowsource

Status
Not open for further replies.
Sep 17, 2001
673
US
I have:
1 form with 1 grid and 2 combobox's
Grid - controlsource = "Citem_master"
In grid changerowcolumn I scatter memvar and the combobox's should change but I am getting inconsistent behaviour.

1st combobox - displays item category description.
rowsource = "Categories.category_description, cat_id_pk"
boundcolumn = 2
boundto = have tried .T. and .F.
controlsource = m.cat_id_fk (in Citem_master)

2nd combobox - displays item subcategory description.
rowsource = "subcat.subcat_description, subcat_id_pk"
boundcolumn = 2
boundto = have tried .T. and .F.
controlsource = m.subcat_id_fk (in Citem_master)

Anyway if someone could suggest how they handle this type scenario?

Regards,

Rob
 
The trick was as posted in other threads:
GRID:
ControlSource = "Citem_master"
ControlSourceType = 6
(afterrowcolumn change I scatter memvar which sets bound controls with matching m.variables to equal values in their lookup tables.)

ComboBox:
RowSourceType = 6
RowSource = "Ccat.cat_desc, cat_id_pk"
BoundTo = .T.
BountColumn = 2
ControlSource = m.cat_id_fk

The only issue I have now is when I drop down the lookup list the combo is bound to the Citem_master table so it won't let me change. I am going to try setting boundto = .F. on dropdown to see if that works.

Regards,

Rob
 
Well my solution works great. By manipulating the boundto property I can allow the user to dropdown and select another item in the list then set the bound property back when the grid moves. I added a custom combobox to my visual classes which has:
INITIAL PROPERTIES:
BoundTo=.T.
BoundColumn=2

DROPDOWN EVENT:
This.BoundTo = .F.

LostFocus EVENT:
This.BoundTo = .T.

Sometimes I have to overide this but it is working great for most of my needs expressed earlier in the thread. The most important thing is to release the boundto when you need to change items in the lookup table but set it back before changing the record pointer of the master grid/table.

Regards,

Rob
 
Well I ended up having to change my supposed solution. The bound to propert MUST stay set if the 2nd column of the lookup table it a numeric value as stated in other threads. I simply had to had a line to the valid of the combobox that sets the m.id_fk to the selected lookup tables primary key.

Regards,

Rob
 
Hello me, its me again. Half of me doesn't know what is going on and the other half does. So I start the thread with one side and the other side answers. So from both of me, thanks for noticing ;).

Marcia, I will download and checkout what you suggest.

Regards,

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top