G
Guest
I am populating a combo box and then want to set the default displayed value to the first item not the null item
THis is my code
strSQL = "SELECT grpmas.itmg_nm, grpmas.itmg_ds FROM grpmas " & _
"WHERE grpmas.itmg_nm Not Like 'CLN' And grpmas.itmg_nm Not Like 'FIN' And " & _
"grpmas.itmg_nm Not Like 'FRT' And grpmas.itmg_nm Not Like 'FTIN' And " & _
"grpmas.itmg_nm Not Like 'HIR' And grpmas.itmg_nm Not Like 'RNT' " & _
"ORDER BY grpmas.itmg_ds;"
Set rsProd = db.OpenRecordset(strSQL)
Me.cboProdGp.AddItem "*;All Groups"
If Not rsProd.EOF Then rsProd.MoveFirst
Do Until rsProd.EOF
Me.cboProdGp.AddItem rsProd!itmg_nm & ";" & rsProd!itmg_ds
rsProd.MoveNext
Loop
' Trying to set it to first row with bound value of "*"
Me.cboProdGp.ListIndex (0)
It should be so easy but I can't work it out.
Thanks
Stephen
THis is my code
strSQL = "SELECT grpmas.itmg_nm, grpmas.itmg_ds FROM grpmas " & _
"WHERE grpmas.itmg_nm Not Like 'CLN' And grpmas.itmg_nm Not Like 'FIN' And " & _
"grpmas.itmg_nm Not Like 'FRT' And grpmas.itmg_nm Not Like 'FTIN' And " & _
"grpmas.itmg_nm Not Like 'HIR' And grpmas.itmg_nm Not Like 'RNT' " & _
"ORDER BY grpmas.itmg_ds;"
Set rsProd = db.OpenRecordset(strSQL)
Me.cboProdGp.AddItem "*;All Groups"
If Not rsProd.EOF Then rsProd.MoveFirst
Do Until rsProd.EOF
Me.cboProdGp.AddItem rsProd!itmg_nm & ";" & rsProd!itmg_ds
rsProd.MoveNext
Loop
' Trying to set it to first row with bound value of "*"
Me.cboProdGp.ListIndex (0)
It should be so easy but I can't work it out.
Thanks
Stephen