Hi guys,

I'm a beginner when it comes to VBA and I'm encountering a rather annoying error with a listbox on a form that I'm writing.

My form has a button that is called Cmd553. It also contains a listbox called lstRecords. The problem arises when I try to add items from a database to the listbox. Upon clicking the 553 button, an error appears saying

Compile Error: Method or data member not found
Also, this line of code is highlighted -

VB Code:
  1. lstRecords -this part highlighted: .AddItem -end highlighting RS!NBR_FUND

I'd appreciate any help you can give. Here's the problematic code

VB Code:
  1. Private Sub Cmd553_Click()
  2.    
  3.     Dim DB As Database
  4.     Dim RS As Recordset
  5.     Dim strAcc As String
  6.     Set DB = CurrentDb()
  7.     strAcc = "SELECT NBR_FUND FROM Label_Root WHERE NBR_COMP IN(553);"
  8.     Set RS = DB.OpenRecordset(strAcc)
  9.    
  10.     If Not RS.EOF Then RS.MoveFirst
  11.     Do While Not RS.EOF
  12.         'txtRes.SetFocus
  13.         'txtRes.Text = txtRes.Text & " : " & RS!NBR_FUND
  14.         lstRecords.SetFocus
  15.         lstRecords.AddItem RS!NBR_FUND
  16.         lstRecords.ItemData(lstRecords.NewIndex) = RS!NBR_FUND
  17.         RS.MoveNext
  18.     Loop
  19.    
  20.     MsgBox "Active"
  21.    
  22. End Sub

Many thanks