Article ID: 129929
Article Last Modified on 1/8/2003
Control Property Value ------------------------------------------ Data1 DatabaseName Biblio.mdb Data1 RecordSource PUBLISHERS Text1 DataSource Data1 Text1 DataField Name Text2 DataSource Data1 Text2 DataField City
Sub Data1_Validate (Action As Integer, Save As Integer)
Dim RC As Integer
Debug.Print "Action "; Action; " generated the Validate event."
If Save Then
Select Case Action
Case vbDataActionFind, _
vbDataActionDelete, _
vbDataActionAddNew, _
vbDataActionCancel, _
vbDataActionClose
'No action
Case vbDataActionMoveNext, _
vbDataActionMovePrevious, _
vbDataActionMoveFirst, _
vbDataActionMoveLast, _
vbDataActionUnload
RC = MsgBox("Save changes to current record?", vbYesNo + _
vbQuestion)
If RC = vbNo Then
Save = False
Debug.Print "The data will NOT be saved."
Else
If Not IsValid() Then
' Write your own IsValid Function to return T/F value
' and do any additional validation that you want.
Action = vbDataActionCancel
End If
End If
Case Else
' This case should never be executed unless a new
' (unhandled) value is added to the Action parameter.
End Select
End If
End Sub
Function IsValid() As Boolean
IsValid = True
' Write your own validation routine here.
End Function
Additional query words: 4.00 vb4win vb4all
Keywords: KB129929