salut
voila j'ai une macro qui insert dans une table accès des donnée.
Elle marche tres bien tant qu'il n y  a pas de date dans la requête SQL.
il y aune erreur de syntaxe mais je ne voit pas quoi ???
	
	1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
   |     Sub ajout_of()
 
        If TextBox3.Text = "" Then
            Exit Sub
        End If
 
        'insertion de data
        Dim Connection As New OleDb.OleDbConnection()
        Dim cmd As OleDbCommand
        Dim DtSet As New DataSet()
        Dim Sql As String
        'ouverture de la connection
        Connection.ConnectionString = "provider=microsoft.jet.oledb.4.0;" & "data source=" & TextBox2.Text & ";"
        Dim dat As String
 
        dat = Date.Now
 
 
        Sql = "insert into ordre (ordre,poste,etat,date-entree,date-sortie) values ('" & TextBox3.Text & "','" & Environment.MachineName() & "','enposte',#" & dat & "#)"
 
        cmd = New OleDbCommand(Sql, Connection)
        Connection.Open()
        cmd.ExecuteReader()
        cmd.Connection.Close()
 
 
        Label6.Text = TextBox3.Text
        Label6.Refresh()
        RadioButton1.Checked = True
        TextBox3.Text = ""
        TextBox3.Enabled = False
        TextBox3.Focus()
 
        System.Threading.Thread.Sleep(1000)
 
        TextBox3.Enabled = True
        RadioButton1.Checked = False
        TextBox3.Focus()
 
 
 
    End Sub | 
 voici un exemple de requete généré par la macro
	
	insert into ordre (ordre,poste,etat,date-entree,date-sortie) values ('1000000','FREUAD0H002682','enposte',#02/12/2011 08:09:54#)
 merci d'avance pour votre
bonne journée
						
					
Partager