Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Dim con As New Connection

Dim rec As New Recordset


Private Sub cmdsave_Click()
rec.AddNew
rec!dateofadm = txtdate.Text
rec!course = txtcourse.Text
rec!studname = txtname.Text
rec.Update
MsgBox "Data Saved Successfully"
txtdate.Text = ""
txtcourse.Text = ""
txtname.Text = ""
txtdate.SetFocus
End Sub

Private Sub Form_Load()


Set con = New Connection
With con
.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=E:\PGDCA\database2.accdb;Persist Security
Info=False"
.Open
End With
Set rec = New Recordset
rec.Open "select * from table1", con,
adOpenDynamic, adLockOptimistic
End Sub

You might also like