For a Form with TextBox Controls named txtTextID, txtItemName, txtType,
txtColor, txtWeight, txtHeight, txtWidth, txtDesc, txtSource, txtCategory,
each bound to a data Field in the Table/Query that is the RecordSource of
the Form, the following code in the BeforeUpdate event does what you want.
It cancels the update if in any of the TextBox controls are Null (nothing
ever entered) or a zero-length string (something entered and deleted).
(Note: this is not "finished" code -- it does not include error handling.
You have to determine what error handling you need and add it.)
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.txtTextID = "" Or IsNull(Me.txtTextID) = True Or _
Me.txtItemName = "" Or IsNull(Me.txtItemName) = True Or _
Me.txtType = "" Or IsNull(Me.txtType) = True Or _
Me.txtColor = "" Or IsNull(Me.txtColor) = True Or _
Me.txtWeight = "" Or IsNull(Me.txtWeight) = True Or _
Me.txtHeight = "" Or IsNull(Me.txtHeight) = True Or _
Me.txtWidth = "" Or IsNull(Me.txtWidth) = True Or _
Me.txtDesc = "" Or IsNull(Me.txtDesc) = True Or _
Me.txtSource = "" Or IsNull(Me.txtSource) = True Or _
Me.txtCategory = "" Or IsNull(Me.txtCategory) = True Then
MsgBox "All information must be filled in"
Cancel = True
End If
Exit_Proc: Exit Sub
End Sub
Larry Linson
Microsoft Access MVP