Accesing specific data in list box

  • Thread starter Thread starter George Papadopoulos
  • Start date Start date
G

George Papadopoulos

Hello everybody

I have placed a list box on a form, which is being populated with records
from a table. I also have a delete record button on the form. When I press
the button I get the currentrow by using the ListIndex method. The code is
shown below :

Private Sub Delete_Spare_Click()
On Error GoTo Err_Delete_Spare_Click

Dim intSafety As Integer
Dim strSelect As String
Dim intRowIndex As Integer
Dim intKwdikos_Antallaktikou As Integer

intSafety = MsgBox("A?oae o?aionio aea oc aeaanao?; ", vbOKCancel)

If (intSafety = vbCancel) Then Exit Sub

MsgBox ("Cotinuing...")

intRowIndex = Me.Spares_List.ListIndex

intKwdikos_Antallaktikou = Me!Spares_List.Column(intRowIndex, 1)

MsgBox (intKwdikos_Antallaktikou)

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Delete_Spare_Click:
Exit Sub

Err_Delete_Spare_Click:
MsgBox Err.Description
Resume Exit_Delete_Spare_Click

End Sub

I have traced the faulty code to the line intKwdikos_Antallaktikou =
Me!Spares_List.Column(intRowIndex, 1).

What can I do to get the value on row 'intRowIndex' and Column 1 of my
listbox.

thx, in advance
 
I think all you need is:

Me!Spares_List.Column(1)

Keep in mind this property is zero based.

Peter
 
Back
Top