deleting from listbox and table (1 Viewer)

kurohige

New member
Local time
Today, 12:39
Joined
Oct 27, 2011
Messages
4
Greetings i been around the forum for sometime and i really found helpful everything in here.. but now i have a "I don't know/don't find it case" place take a look at my code, for some reason is no erasing the data.

Code:
Private Sub btnDeleteLst_Click()
'If no record is selected just leave the sub
If IsNull(txtDispDate) Then
    Exit Sub
End If


Dim strSQL As String
DoCmd.SetWarnings False
'strSQL = "DELETE " & _
'   "FROM [Shift DT] " & _
'   "WHERE [Shift DT].Inspector= '" _
'   & Me!lstDisplayData.Column(1) & "' AND  [Shift DT].Date= " & Me!lstDisplayData.Column(2) & _
'   " AND [Shift DT].StartTime= #" & Me!lstDisplayData.Column(3) & "# AND [Shift DT].FinishTime= #" _
'   & Me!lstDisplayData.Column(4) & "# AND [Shift DT].Comments = '" & Me!lstDisplayData.Column(5) & "';"
DoCmd.RunSQL ("DELETE " & _
   "FROM [Shift DT] " & _
   "WHERE [Shift DT].Inspector= '" _
   & Me!lstDisplayData.Column(1) & "' AND  [Shift DT].Date= " & Me!lstDisplayData.Column(2) & _
   " AND [Shift DT].StartTime= #" & Me!lstDisplayData.Column(3) & "# AND [Shift DT].FinishTime= #" _
   & Me!lstDisplayData.Column(4) & "# AND [Shift DT].Comments = '" & Me!lstDisplayData.Column(5) & "';")

Me!lstDisplayData.Requery ' requery the list

   
End Sub
thanks for your help ^^
 

kurohige

New member
Local time
Today, 12:39
Joined
Oct 27, 2011
Messages
4
yes it was the # thank you very much.!!! :D
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 12:39
Joined
Aug 30, 2003
Messages
36,140
No problemo!
 

Users who are viewing this thread

Top Bottom