Hi there,
I am trying to put a condition on a find student button so that tutors can only find a student to add to a record if the record is a blank one. The easiest way to do this is to write an if statement to check if there is a studentid in the record. If there is a studentID in the record then a messagebox should appear, if there is no a studentid in the record then a popform should appear.
Here is my code:
Maybe this is something really simple, any advice appreciated!
I am trying to put a condition on a find student button so that tutors can only find a student to add to a record if the record is a blank one. The easiest way to do this is to write an if statement to check if there is a studentid in the record. If there is a studentID in the record then a messagebox should appear, if there is no a studentid in the record then a popform should appear.
Here is my code:
Code:
Private Sub StudentName_Click()
If Forms![frm_tutor]![tutorial].Form![StudentID] = Null Then
DoCmd.OpenForm "frmStudentSearch1"
Else
MsgBox "You are trying to overwrite the existing record. Please click 'Add Tutorial' to go to a blank record."
Exit Sub
End If
End Sub
Maybe this is something really simple, any advice appreciated!