Attendance Management System Using MS Access and VB 6 Part 5 – This is the final part of the attendance management project. You will learn about MDI form and creating a module for database connection in this part.
Now that we have created all our form successfully by following previous articles of this project, you must assemble them in one place. The MDI form is a special kind of form in Visual Basic 6 which display only one form at a time. Also, there is an option to create a custom menu for your project.
Creating MDI From For Attendance Management
The first step is to create an MDI Form from Project Explorer. Note that you cannot create more than one MDI Form.
Right-click Form Name and click Add, and select MDI Form. A new form will appear similar to one shown below. In your case, the form will not have menus. In this section we will learn to create menus for Attendance Management system, moreover, each of the menus is visible to specific users, and not others depending on their privilege.
View Attendance Menu
The view attendance menu is for students. To create the menu, click the Menu Editor on the standard toolbar. Enter following details for view attendance menu.
Code For ViewAttendance
Enter following code for view attendance menu.
Private Sub menuViewAtten_Click(Index As Integer) If frmSplash.userlogin >= 900 Then frmTodayAttendance.Hide frmViewAttendance.Show End If frmStudent.Hide frmViewAttendance.Show frmTodayAttendance.Hide frmTeacherRecord.Hide End Sub
Today Attendance Menu
The today attendance menu is only for teacher to mark current attendance and it is not visible to even admin. Create another menu with following details.
Code for Today Attendance
Add the following code to today attendance code editor.
Private Sub menuToday_Click(Index As Integer) If frmSplash.userlogin >= 900 Then frmTodayAttendance.Show frmViewAttendance.Hide End If frmStudent.Hide frmViewAttendance.Hide frmTodayAttendance.Show frmTeacherRecord.Hide End Sub
Student Record Management Menu
The next menu – student record management is used only by admins to update, add, or delete student records. Create another menu for student record management.
Code For Student Record Management
Private Sub menuStuRec_Click(Index As Integer) frmStudent.Show frmViewAttendance.Hide frmTodayAttendance.Hide frmTeacherRecord.Hide End Sub
Teacher Record Management Menu
The teacher record management is the responsibility of admin, therefore, only they can view this menu. Now, create a new menu from menu editor using following details.
Code For Teacher Record Management
Private Sub menuTeachRec_Click(Index As Integer) frmStudent.Hide frmViewAttendance.Hide frmTodayAttendance.Hide frmTeacherRecord.Show End Sub
This menu item exit the MDI form. Create a new menu item using the following detail.
Code For Menu Exit
Private Sub exit_Click(Index As Integer) Unload Me End Sub
Code For MDI Form Load
Private Sub MDIForm_Load() If frmSplash.userlogin >= 100 And frmSplash.userlogin < 900 Then menuStuRec.Item(3).Enabled = False menuTeachRec.Item(4).Enabled = False menuToday.Item(2).Enabled = False menuViewAtten.Item(0).Enabled = True ElseIf frmSplash.userlogin >= 900 Then menuStuRec.Item(3).Enabled = False menuTeachRec.Item(4).Enabled = False menuToday.Item(2).Enabled = True menuViewAtten.Item(0).Enabled = True Else menuStuRec.Item(3).Enabled = True menuTeachRec.Item(4).Enabled = True menuToday.Item(2).Enabled = False menuViewAtten.Item(0).Enabled = True End If End Sub
The form load event checks the user login id and allow only specific menu items. If a student has logged in then all other menu except view attendance is disabled. If a teacher is logged in then all record management menu will be disabled automatically.