Hello!!
I have an access database for devices each line contain 11 fields + the ID automatically generated by access! In excel i have a userinterface where you can add/modify/delete devices! Add and modify work well! But for the delete option I have the following message : "syntax error missing operator" on the following line: basedonnee.CurrentDb.Execute "DELETE Seriennummer from dispositif where Seriennummer=" & SN & ";"
Here is my code: Private Sub CommandButton1_Click()
Dim basedonnee As Access.Application
Dim refe As String, donnee As Integer
refe = ThisWorkbook.Path & "\projetVBA.mdb"
Set basedonnee = GetObject(refe)
basedonnee.Visible = False
' castage de la donnee dans listbox1 en integer
donnee = CInt(listbox1)
If Not IsEmpty(donnee) Then
basedonnee.CurrentDb.Execute "DELETE Seriennummer from dispositif where Seriennummer=" & SN & ";"
Else
MsgBox " Aucun dispositif sélectionné "
End If
Supprimer_dispositif.Hide
Unload Supprimer_dispositif
End Sub
The error is on the word: "Seriennummer"
I don't understand why!!
Here is the excel file: projetVBA.xls
Thank you very much for your help!!
Bookmarks