B
brlang
I have a box on a form that I am trying to validate the length of based
on a field in another form. I have tried using vb code but I get a
type match error or can not find the form if using the logic below. I
do not think that I have the right process in the code as I am new to
this. Code I have used in the beforeupdate is below:
Private Sub key2_BeforeUpdate(Cancel As Integer)
Lengthoffield = Len(Me.[key2])
If Lengthoffield > Forms![qry_key definitions]![key_key2_len] Then
MsgBox "You have entered information that is too long for the
field."
Cancel = True
End If
End Sub
on a field in another form. I have tried using vb code but I get a
type match error or can not find the form if using the logic below. I
do not think that I have the right process in the code as I am new to
this. Code I have used in the beforeupdate is below:
Private Sub key2_BeforeUpdate(Cancel As Integer)
Lengthoffield = Len(Me.[key2])
If Lengthoffield > Forms![qry_key definitions]![key_key2_len] Then
MsgBox "You have entered information that is too long for the
field."
Cancel = True
End If
End Sub