Question : Add data to Access Listbox

I am in Access 2007 and have a form with a list box. I have a query that populates the listbox initially, but want to add values to it in VBA as well. I have tried .additem   but it is not working. It keeps saying that the argument is not optional. Below is my code.

lstcount = Me.LstGrants.ListCount
For i = (Me.LstGrants.ListCount + 1) To ((Me.LstGrants.ListCount + 1) + 4)
    year = year + 1
'    Me.LstGrants.AddItem grantdesc
    With Me.LstGrants
     Do
      .AddItem
      .List(i, 0) = grantdesc
      .List(i, 1) = year
    End With
  Next

Answer : Add data to Access Listbox

Perhaps this
1:
2:
3:
4:
5:
6:
For i = (Me.LstRHFGrants.ListCount + 1) To ((Me.LstRHFGrants.ListCount + 1) + 4)
    year = year + 1
    With Me.LstRHFGrants
      .AddItem (grantdesc & ";" & year)
    End With
Next
Random Solutions  
 
programming4us programming4us