Full Version: Form BeforeUpdate event hitting on Subform when Main Form Loads
UtterAccess Forums > Microsoft® Access > Access Forms
ecurns
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:
[code]
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
txtCheckNumber.SetFocus
Cancel = True
Exit Sub
Else
Me.Undo
End If
End If
End Sub
ecurns
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:
[code]
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.