Hi,
I don’t know much about VBA coding but I would be very grateful if someone would help me in writing a code for my database Access file.
I already have a code that control value in General ledger. So whenever balance is not 0 that means that filed »Diff1« is not equal to 0, there is a MSg Box »Debit and Credit Must be equal«, as showed in example below (see STEP 2).
The problem is that this works only when I close the main Form. However, I want to make the same conditions when I add new record to a main and not when I exit form?
So that would be something like this:

STEP 1: This code would be for MAIN form named "EntryHead"
*****************************************************
Private Sub Form_Current()
If Me.NewRecord Then
do the STEP 2 ???
*****************************************************

STEP 2: This code already works in my SUB form named "GeneralLedger_subform"
*****************************************************
Private Sub GeneralLedger_subform_Exit(Cancel As Integer)
If Me.Diff1.Value < 0 Or Me.Diff1.Value > 0 Then
MsgBox "Debit and Credit Must be equal", vbOKOnly
Diff1.SetFocus
Else
MsgBox "Records are Saved", vbOKOnly
End If
End Sub

*****************************************************

Can I somehow merge SPEP1 and STEP 2 in one code?



thanks for your help!
Greg