Hi guys
I need some help here. It may be a simple problem to some of u but I don't have much experience in Access
I have a dialog box that ask user to enter the full name of student so that it can display a form that have the details of the student.
I would like an error message to pops up when the user entered a non-existing student. Under which event should I put the code for displaying the error message?
I'm planning to put these code here in the event (it has the same purpose with what I want but this is an error msg of non-existing student for a report of student's record)
Private Sub Report_NoData(Cancel As Integer)
' Display a message if user enters a name of student for which there are no records,
' and don't preview or print report.
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
strMsg = "You must enter a valid student's name"
intStyle = vbOKOnly
strTitle = "No Data for Student"
MsgBox strMsg, intStyle, strTitle
Cancel = True
End Sub
Can I use the same code for the form as well?
Thanks in advance
I need some help here. It may be a simple problem to some of u but I don't have much experience in Access

I have a dialog box that ask user to enter the full name of student so that it can display a form that have the details of the student.
I would like an error message to pops up when the user entered a non-existing student. Under which event should I put the code for displaying the error message?
I'm planning to put these code here in the event (it has the same purpose with what I want but this is an error msg of non-existing student for a report of student's record)
Private Sub Report_NoData(Cancel As Integer)
' Display a message if user enters a name of student for which there are no records,
' and don't preview or print report.
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
strMsg = "You must enter a valid student's name"
intStyle = vbOKOnly
strTitle = "No Data for Student"
MsgBox strMsg, intStyle, strTitle
Cancel = True
End Sub
Can I use the same code for the form as well?
Thanks in advance
