>How do you add 2 items to each row (one being a group, the other a group id) without displaying the 2nd item? I know how to do it using a SQL statement as the rowsourcetype, but I can't get it working in the INIT() event. I have:
>
>THIS.ADDITEM("
",1,1)
>x = 2
>SCAN
> THIS.ADDITEM(t_groups.group_name,x,1)
> THIS.ADDITEM(t_groups.group_code,x,2)
> x = x + 1
>ENDSCAN
Michael,
In that case you use AddListItem() - replace additem with addlistitem.
In AddItem() second parameter is item index, where in AddLIstItem it's Item id.
However especially with long tables this would be time consuming and unnecessary. Use SQL rowsourcetype instead.
with this
.RowSourceType = 3
.RowSource = 'select group_name, group_code '+;
'from myTable '+;
'where myCriteria '+;
'order by 1'+;
'into cursor crsCombo'
.Columncount = 2
.BoundColumn = 2
.ColumnWidths ='100,0'
.Style = 2
endwith
Your criteria values might change on the fly. In that case you do a combo.requery. At any time instead of saying :
thisform.myCombo.Value or thisform.myCombo.List(thisform.myCombo.ListIndex,2) you could simply say :
crsCombo.Group_code or crsCombo.Group_Name to query any column in selected row.
Cetin