Computing Module 3 Writeup

Authors Avatar

Defining data requirements:

Examiner (ExaminerNumber, Forename, Surname, Address, Postcode, SubjectReferenceCode)

Centre (CentreNumber, NumberOfCandidatesEntered, ExaminerNumber, SubjectReferenceCode)

Subject (SubjectReferenceCode, SubjectName, Payment)

Examiner Table:

Centre Table:

Subject Table:


Data Entry Form For A Centre:

Data Entry Form For An Examiner:

Implementation Of Tables In A Database:

Centre Table:

As you can see, the fields CentreNumber and SubjectReferenceCode have been made joint primary keys. This is so that a centre can enter candidates for more than one subject. For example, if CentreNumber was the primary key on its own, then we could only enter candidates from the centre for one subject because if the CentreNumber was repeated, it would not be unique and therefore fall foul of the uniqueness check. Therefore, with both fields, CentreNumber and SubjectReferenceCode being made joint primary keys, we can enter candidates for more than one subject from a particular centre, because the CentreNumber and SubjectReferenceCode combination will be unique, so it will pass the uniqueness validation rule.

Validation Rules:

Examiner Table:

Validation Rules:

Subject Table:

Validation Rules:

Validation Of Data Entered In Visual Basic:

For entering data to the Add Centre Form, I used the following validation:

Private Sub CmdAddCen_Click()

    If (Validate() = True) Then

        datCentre.Recordset.Update

        datCentre.Recordset.AddNew

    End If

End Sub

Private Sub CmdCloseCen2_Click()

   Unload Me

End Sub

Private Sub Form_Load()

    datCentre.Recordset.AddNew

End Sub

Public Function Validate() As Boolean

    Validate = True

   

    If (txtCentreNo.Text = "") Then

        MsgBox ("Centre number has to be entered")

        Validate = False

        Exit Function

    End If

    If txtCentreNo.Text < 10000 Then

        MsgBox ("Centre number must be between 10000 and 79999")

        Validate = False

        Exit Function

    End If

    If txtCentreNo.Text > 79999 Then

        MsgBox ("Centre number must be between 10000 and 79999")

        Validate = False

        Exit Function

    End If

    If (txtExaminerNo.Text = "") Then

        MsgBox ("Examiner number has to be entered")

        Validate = False

        Exit Function

    End If

    If txtExaminerNo.Text < 100000 Then

        MsgBox ("Centre number must be between 100000 and 999999")

        Validate = False

    Exit Function

    End If

    If txtExaminerNo.Text > 999999 Then

        MsgBox ("Centre number must be between 100000 and 999999")

        Validate = False

    Exit Function

    End If

    If (txtCandidatesEntered.Text = "") Then

        MsgBox ("Number of candidates entered has to be entered")

        Validate = False

        Exit Function

    End If

   

End Function

In the validation rules for the Add Centre form listed above, txtCentreNo.Text = “” means that the field has been left blank, as demonstrated above. This produces a message box, which displays the error.

The validate value starts off True. If any of the validation criterion are breached, then this validate value is made False and this value is taken up into CmdAddCen Public Sub and this stops the database from being updated, as it will only be updated if Validate=True.

The validation checking loop starts off at the top. So, if no value had been entered for Centre Number, a message box would pop up displaying the error. Once this has been rectified and the validation rule passes, validate gets reset to True and the loop continues. If Examiner Number has been left blank or is out of the specified range, then another message box would pop up displaying the error.

Join now!

For entering data to the Add Examiner Form, I used the following validation:

Private Sub Form_Load()

    datExaminer.Recordset.AddNew

End Sub

Public Function Validate() As Boolean

    Validate = True

   

    If (txtExaminerNo.Text = "") Then

        MsgBox ("Examiner number has to be entered")

        Validate = False

        Exit Function

    End If

    If txtExaminerNo.Text < 100000 Then

        MsgBox ("Centre ...

This is a preview of the whole essay