J
joyo
Hi,
Below is my code, I don't know why it doesn't work.
I think the problem is in "*" line, but I can not figure
it out. I also tried to add "#" between the date field.
Private Sub RemoveButton_Click()
On Error GoTo Err_RemoveButton_Click
Dim db As DAO.database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_Holidays",
dbOpenDynaset)
Dim SelectedItemIndex As Integer
SelectedItemIndex = Me.HolidayList.ListIndex
If Not (SelectedItemIndex) = -1 Then
Do Until rs.EOF
******* If rs!HoliDate = Me.HolidayList.Column
(0, SelectedItemIndex) Then
rs.Delete
End If
rs.MovePrevious
Loop
Else
MsgBox "You need to select a item first"
End If
Exit_RemoveButton_Click:
Exit Sub
Err_RemoveButton_Click:
MsgBox Err.Description
Resume Exit_RemoveButton_Click
End Sub
Thanks
joyo
Below is my code, I don't know why it doesn't work.
I think the problem is in "*" line, but I can not figure
it out. I also tried to add "#" between the date field.
Private Sub RemoveButton_Click()
On Error GoTo Err_RemoveButton_Click
Dim db As DAO.database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_Holidays",
dbOpenDynaset)
Dim SelectedItemIndex As Integer
SelectedItemIndex = Me.HolidayList.ListIndex
If Not (SelectedItemIndex) = -1 Then
Do Until rs.EOF
******* If rs!HoliDate = Me.HolidayList.Column
(0, SelectedItemIndex) Then
rs.Delete
End If
rs.MovePrevious
Loop
Else
MsgBox "You need to select a item first"
End If
Exit_RemoveButton_Click:
Exit Sub
Err_RemoveButton_Click:
MsgBox Err.Description
Resume Exit_RemoveButton_Click
End Sub
Thanks
joyo