Free Source Code and Tutorials

Custom Search

07-Add Academic Year

Last time we have finished the “Year Level” module of the student. Now, we will add another module which is “Academic Year” in the settings. This module allows you to manage the “Academic Year” of the students that contain adding, updating,retrieving and removing. We are now going to focus on how to add the “Academic Year” in Ms Access Database using Visual Basic 2008.


Let’s begins:


Open the project that I have created previously which is “StudentInformation” and do the Form just like this.
After setting up the Form, double click the “Save” Button inside the “Academic Year” GroupBox and do this following code for saving the “Academic Year” inside the event handler of a Button. It will look like this.

  1. Private Sub btnsySave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsySave.Click
  2. Try
  3. 'opening the connection
  4. con.Open()
  5. 'store a query to a variable that you have declared.
  6. query = "INSERT INTO tblsy (SY) VALUES ('" & txtsy.Text & "')"
  7. 'set a query and a connection string to a class that you have declared.
  8. da = New OleDb.OleDbDataAdapter(query, con)
  9. dt = New DataTable
  10. 'Filling the data in the datatable
  11. da.Fill(dt)
  13. MsgBox("New School Year has been saved.")
  14. txtsy.Clear()
  16. Catch ex As Exception
  17. 'catching error
  18. MsgBox(ex.Message)
  19. End Try
  20. con.Close()
  21. End Sub
Facebook Comments
(Visited 1 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: