Full Version: Form BeforeUpdate event hitting on Subform when Main Form Loads
UtterAccess Forums > Microsoft® Access > Access Forms
Ok... I added in some code to check to see if a field was blank on my subform in the before update event of my subform. However when I open up my main form this code is firing off... why?
ubform's BeforeUpdate event:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intCKnumResPonse As Integer
If Nz(txtCheckNumber) = "" Then
intCKnumResPonse = MsgBox("Check Number is Required. Click OK to go back and enter a check number, or Cancel to cancel payment.", vbOKCancel)
If intCKnumResPonse = 1 Then
Cancel = True
Exit Sub
End If
End If
End Sub
Ok I think I know why... it's because I have an event on form load and it's assigning the FK on Load.
mm... how should I do this? I need the FK assigned on load so it pulls and writes to the correct record, however I want to program in checks for missing data fields.
Form's Load Event:
Private Sub Form_Load()
CashRecordID = [Forms]![caseinformation]![RecordID]
End Sub
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.