edit code pls

  • Thread starter Thread starter satty via AccessMonster.com
  • Start date Start date
S

satty via AccessMonster.com

does anyone know how to edit the code?

I'm trying to say -

If txtbox - PM_Surname is Not Null then, PM_ADDRESS and PM_POSTCODE must be
written too.

so far i've got the first line but am clueless what to write next!-

In PM_SURNAME AfterUpdate:

If Not (IsNull(me.PM_SURNAME)) Then
 
Use the before update event of the form to check the values in the text boxes

If txtbox - PM_Surname is Not Null then, PM_ADDRESS and PM_POSTCODE must be
written too.

so far i've got the first line but am clueless what to write next!-

In PM_SURNAME AfterUpdate:

If Len(me.PM_SURNAME & "") = 0 And (Len(Me.PM_ADDRESS & "") = 0 Or
Len(Me.PM_POSTCODE & "") = 0) Then
MsgBox "Fields must be filled"
Cancel = True ' wont let the user continue untill both fields are filled
End If
 
If Not IsNull(Me.PM_SURNAME) Then
If IsNull(Me.PM_ADDRESS) Or IsNull(Me.PM_POSTCODE) Then
MsgBox "Hey! Address and post code, please!"
End If
End If
 
Sorry, the first criteria should be <>, and the reasone why I use the Len, a
text field can be empty ("") and not Null

If Len(me.PM_SURNAME & "") <> 0 And (Len(Me.PM_ADDRESS & "") = 0 Or
Len(Me.PM_POSTCODE & "") = 0) Then
MsgBox "Fields must be filled"
Cancel = True ' wont let the user continue untill both fields are filled
End If
 
Back
Top