hi all
how can i use VBA to inter or delete date to Access Table ??
****************************************************
using recordset
------------------------------------------------------------------
Dim rstUserData As New ADODB.Recordset
Dim rstSqlStr As String
Dim recCount As Single
rstSqlStr = "Select * from UserData"
If rstUserData.State = adStateClosed Then rstUserData.Open rstSqlStr, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
recCount = rstUserData.RecordCount
rstUserData.AddNew
rstUserData.Fields(0) = "First Name"
rstUserData.Fields(1) = "Second Name"
rstUserData.Update
------------------------------------------------------------------
where rstUserData is record set (which is linked to the table with sqlstr)
and UserData is table in the database.
*****************************************************
to delete data, depends on whether you want to delete the entire data in the table or on a particular condition.
Similarly create an Sql Delete statement and run according to requirement.