bunnahabhain
Established Member
- Joined
- 8 Jun 2005
- Messages
- 2,070
Now most of you wont understand what the hell I'm on about, but I'm having a spot of bother with a little bit of VB coding and was wondering if anybody knew how to rectify it.
What I'm having trouble with, is an If Statement with the 'vbYesNo' bit of a Message Box.
That is the code, which is for a Delete Button, with the half completed If Statement at the bottom, does anybody know how to get the thing to stop thinking 'Response' and '"Yes"' should be Variables and that they need to be defined?[/code]
What I'm having trouble with, is an If Statement with the 'vbYesNo' bit of a Message Box.
Code:
Private Sub cmdDelete_Click()
If lstDisplayName.ListCount = 0 Then
MsgBox "You must select something to Delete from the Database", vbOKOnly, "Error"
Else
MsgBox "Are you sure you want to Delete what you have selected?", vbYesNo, "Question"
If Response = "Yes" Then
lstDisplayName.RemoveItem (lstDisplayName.ListIndex)
lstDisplayID.RemoveItem (lstDisplayID.ListIndex)
lstDepartment.RemoveItem (lstDepartment.ListIndex)
lstSalary.RemoveItem (lstSalary.ListIndex)
lstDisplayGrade.RemoveItem (lstDisplayGrade.ListIndex)
Else
End If
End If
End Sub
That is the code, which is for a Delete Button, with the half completed If Statement at the bottom, does anybody know how to get the thing to stop thinking 'Response' and '"Yes"' should be Variables and that they need to be defined?[/code]