C
Carlos Silva
Hello, I'm tryng to avoid
NULLs values when entering data in a form
the table fields are
IDPayItem ' this is a long integer field
NoOrder
ItemCode
ItemDescription
ItemUnit
Price
PayList
on the form i have a code that
creates automacally a nomber for IDPayitem and
this numbers is aasigned once NoOrder got focus
the fields that I use for the check of Null values are
tboItemCode
tboItemDescription
tboPrice
tboPayList
then I use this Procedure for BeforeUpdate
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(tboItemCode.Value) Then
MsgBox "CHECK EMPTY FIELD ITEM CODE"
Cancel = True
End If
If IsNull(tboItemDescription.Value) Then
MsgBox "CHECK EMPTY FIELD ITEM DESCRIPTION"
Cancel = True
End If
If IsNull(tboPrice.Value) Then
MsgBox "CHECK EMPTY FIELD PRICE"
Cancel = True
End If
If IsNull(tboPayList.Value) Then
MsgBox "CHECK EMPTY FIELD TYPE PAYLIST"
Cancel = True
End If
End Sub
what happens is that when the user hit the close button
after all the Msgbox appears
this message appears..
-----------------------------------------------------------
You can't save this record at this time.
"database" may have encountered an error while trying
To save a record.
If you close this object now, the data changes you made will
be lost.
Do you want to close the database object anyway?
Yes No
----------------------------------------------------------------
Is there another better way of avoiding saving null values
when user closes the forms? is there a way to trigger some action
when te user hits the 'ESC' Key??
thank you very much
Carlos silva
NULLs values when entering data in a form
the table fields are
IDPayItem ' this is a long integer field
NoOrder
ItemCode
ItemDescription
ItemUnit
Price
PayList
on the form i have a code that
creates automacally a nomber for IDPayitem and
this numbers is aasigned once NoOrder got focus
the fields that I use for the check of Null values are
tboItemCode
tboItemDescription
tboPrice
tboPayList
then I use this Procedure for BeforeUpdate
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(tboItemCode.Value) Then
MsgBox "CHECK EMPTY FIELD ITEM CODE"
Cancel = True
End If
If IsNull(tboItemDescription.Value) Then
MsgBox "CHECK EMPTY FIELD ITEM DESCRIPTION"
Cancel = True
End If
If IsNull(tboPrice.Value) Then
MsgBox "CHECK EMPTY FIELD PRICE"
Cancel = True
End If
If IsNull(tboPayList.Value) Then
MsgBox "CHECK EMPTY FIELD TYPE PAYLIST"
Cancel = True
End If
End Sub
what happens is that when the user hit the close button
after all the Msgbox appears
this message appears..
-----------------------------------------------------------
You can't save this record at this time.
"database" may have encountered an error while trying
To save a record.
If you close this object now, the data changes you made will
be lost.
Do you want to close the database object anyway?
Yes No
----------------------------------------------------------------
Is there another better way of avoiding saving null values
when user closes the forms? is there a way to trigger some action
when te user hits the 'ESC' Key??
thank you very much
Carlos silva