andy_dyer
Registered User.
- Local time
- Today, 20:35
- Joined
- Jul 2, 2003
- Messages
- 806
Hi,
I'm trying to get my database to check if fields are completed prior to exit and if not take them back to the missing fields... I've managed this on previous databases but this one is complicated with a subform...
I want to check whether a field (txtInvoiceAmount) has an entry and if it is greater than 0... if yes to both then great if not to either or both then I want to set the focus to the field on the right record within the subform...



At present - it does nothing on the button being clicked so it is obviously not registering something somewhere...
Any ideas??
I'm trying to get my database to check if fields are completed prior to exit and if not take them back to the missing fields... I've managed this on previous databases but this one is complicated with a subform...
I want to check whether a field (txtInvoiceAmount) has an entry and if it is greater than 0... if yes to both then great if not to either or both then I want to set the focus to the field on the right record within the subform...



Code:
Private Sub cmdReturntoMenu_Click()
If Me.NewRecord And Me.Dirty = False Then
DoCmd.Close
DoCmd.OpenForm "frmMainMenu"
Exit Sub
End If
If Me!Invoice.Form!txtInvoiceAmount > 0 Then
DoCmd.Close
DoCmd.OpenForm "frmMainMenu"
Exit Sub
End If
If Me!Invoice.Form!txtInvoiceAmount = Null Or 0 Then
DoCmd.OpenForm "frmError4"
Me!Invoice.Form!txtInvoiceAmount.SetFocus
Exit Sub
End If
End Sub
At present - it does nothing on the button being clicked so it is obviously not registering something somewhere...
Any ideas??