Salut,
Allez PCPT, c'est partit....Il veut !
Dans ton projet rajoute la référence :
Microsoft ActiveX Data Objects 2.5 Library
Option Explicit
Dim Cnx As New ADODB.Connection
Dim Rst As NEW ADODB.RecordSet
Dim sSql As String
Private Sub Form_Load()
' Choix du fournisseur
Cnx.Provider = "Microsoft.jet.OLEDB.4.0"
' Chemin de la base
Cnx.ConnectionString = "CheminDeTaBase"
' Ouvre la connexion à la source
Cnx.Open
' Test
If Not Cnx.State = 1
MsgBox "Connexion echouée !"
Exit sub
End if
' Préparation Requête
sSql = "INSERT INTO TaTable(Id_société,[Libellé sct],AdressN,[code postale],ville,phone,fax,mail)" & _
"Values('" & Replace(TxtId_société.Text, "'", "''") & "','" & Replace(TxtLibelléSct.Text, "'", "''") & "','" & Replace(TxtAdresse.Text, "'", "''") & "'," & _
" '" & TxtCodePostal.Text & "','" & Replace(TxtVille.Text, "'", "''") & "','" & TxtPhone.Text & "'," & _
" '" & TxtFax.Text & "','" & Replace(TxtMail.Text, "'", "''") & "'"
' Execution requête avec paramètre recordset via Cnx
Rst.CursorLocation = adUseClient
Rst.Open sSql, Cnx, adOpenDynamic, adLockPessimistic
' Ici je ferme tout, mais tu le mets ou tu veux...hein !
' Tu peux tant servir dans une Sub : CloseDataBase
On Error Resume Next
Rst.Cancel
Rst.Close
Set Rst = Nothing
Cnx.Cancel
Cnx.Close
Set Cnx = Nothing
Err.Clear
Note : J'espère ne rien avoir oublié....
A+
Exploreur
Linux a un noyau, Windows un pépin 