This code connects to an Access database, allows the user to enter student admission data into text boxes, adds the data to a recordset table, updates the database, displays a confirmation message, and clears the text boxes. It loads the form, establishes a connection to the Access file, opens a recordset table, and prepares to accept user input for saving new admission records.
This code connects to an Access database, allows the user to enter student admission data into text boxes, adds the data to a recordset table, updates the database, displays a confirmation message, and clears the text boxes. It loads the form, establishes a connection to the Access file, opens a recordset table, and prepares to accept user input for saving new admission records.
This code connects to an Access database, allows the user to enter student admission data into text boxes, adds the data to a recordset table, updates the database, displays a confirmation message, and clears the text boxes. It loads the form, establishes a connection to the Access file, opens a recordset table, and prepares to accept user input for saving new admission records.
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