I have crated a userform in access 2007 and used this code to insert in table.

Private Sub Save_Click()
If School.Value = "" Then
MsgBox ("Enter School ID")
School.SetFocus
Exit Sub
End If

Dim insertstring As String

DoCmd.SetWarnings (False)
insertstring = "INSERT INTO Classroom (School_id) VALUES ('" & School.Value & "' );"
DoCmd.RunSQL insertstring
end sub

When i press SAVE command for the first time with Schooltxtbox empty, the values are inserted into table without checking if the text box for school is empty. Again for the second time when i click save then it only the checks for the textbox if its empty. Why is this psl help...