You could query the table for the values you just inserted (see also sample on closing the connection)
cSQL = "Select course,name,[date] From Training Where ";
+ "course = '" + lcCourse + "' ";
+ "And name = '" + lcEmployeeName + "' " ;
+ "And [date] = '" + ldDate + "'"
oRS = oCn.Execute(cSQL)
If oRS.EOF And oRS.BOF Then
Endif
oCn.Close
Note that this assumes that the course+name+date combination is unique in the table. If it is not, then this code will not accurately tell you if the insert was succesful. HTH
>Crescencio,
>
>How can I check that my insert succesfully executed.
>
>Here is the code for my insert:
>
>********************************************************************
>cSQL = "INSERT INTO Training ( course, name , [date] ) ;
> Values ( " + "'" + lcCourse + "' , ;
> " + "'" + lcEmployeeName + "' , ;
> " + "'" + ldDate + "' )"
>oCn.Execute(cSQL)
>*******************************************************************
>
>
>Also do you know how to close the connection.
>
>Here is how I created the connection :
>
>***********************************************************
>lcMDBStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=l:\ehs\data\eh&s.mdb;"
>oCn = Create("adodb.Connection")
>oCn.Open(lcMDBStr)
>
>*********************************************************
>
>Thanks in advance,
>Sergio