Add code to CloseButton
oh the pain you are using subforms...
Private Sub btnclose_Click()
If IsNull(Forms![frmMainForm]![frmsubform]!subformcontrol.Value)
Or Forms![frmMainForm]![frmsubform]!subformcontrol.Value = "" Then
MsgBox "Enter product code.", vbOKOnly, "Product code missing"
Forms![frmMainForm]![frmsubform].SetFocus
Forms![frmMainForm]![frmsubform]!subformcontrol.SetFocus
Else
DoCmd.Close
End If
End Sub
also as a note you need to set focus to the subform first before you
can set focus tot he control on the subform
this is your problem Form.Control
Regards
Kelvan
|