Okay so I have this code to open the form:
Code:
Private Sub Command141_Click()
DoCmd.OpenForm "frmAddBillable", , , , acFormAdd
Forms("frmAddBillable").fkProjectID = Me.fkProjectID
So this automatically creates a new record, however if nothing is entered say in field "Employee" I want the form to close without the new record being created. This was my attempt at a solution but it got very messy:
Code:
Private Sub Form_Unload(Cancel As Integer)
If (Nz(Me.Employee, 0) = 0) Then
DoCmd.RunCommand acCmdUndo
DoCmd.Close acForm, "frmaddbillable"
End If
End Sub
Any help would be appreciated. Thanks!