Hi all,
I am not sure if I am doing it right, but I am trying to insert net data in a access database using VB6 I can connect to the database My question is how do I open the table to insert new record?
If u used the select statement that work fine.
Please help
My code below
Private Sub cmdsave_Click()
Dim oConn As New ADODB.Connection
Dim strSQL As String
Dim rsdb As ADODB.Recordset
Dim firstname As String
Set oConn = CreateObject("ADODB.Connection")
Set rsdb = CreateObject("ADODB.RecordSet")
oConn.Mode = adModeShareExclusive
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Hfc\holyfamily.mdb;"
'Set strSQL = Open("personalinfo")
'Set rsdb = DB.OpenRecordset("personalinfo", dbOpenDynaset)
'strSQL = "Select * from personalinfo"
rsdb.Open strSQL, oConn, adOpenStatic
rsdb.AddNew
'rs("entrydate") = entrydate
'rsdb("registration") = Me![txtreg]
rsdb("fname") = Me![txtfirst]
rsdb("mname") = Me![txtmiddle]
rsdb.Update
rsdb.Close
End Sub
I am not sure if I am doing it right, but I am trying to insert net data in a access database using VB6 I can connect to the database My question is how do I open the table to insert new record?
If u used the select statement that work fine.
Please help
My code below
Private Sub cmdsave_Click()
Dim oConn As New ADODB.Connection
Dim strSQL As String
Dim rsdb As ADODB.Recordset
Dim firstname As String
Set oConn = CreateObject("ADODB.Connection")
Set rsdb = CreateObject("ADODB.RecordSet")
oConn.Mode = adModeShareExclusive
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Hfc\holyfamily.mdb;"
'Set strSQL = Open("personalinfo")
'Set rsdb = DB.OpenRecordset("personalinfo", dbOpenDynaset)
'strSQL = "Select * from personalinfo"
rsdb.Open strSQL, oConn, adOpenStatic
rsdb.AddNew
'rs("entrydate") = entrydate
'rsdb("registration") = Me![txtreg]
rsdb("fname") = Me![txtfirst]
rsdb("mname") = Me![txtmiddle]
rsdb.Update
rsdb.Close
End Sub