Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2011
    Posts
    28

    Unanswered: Code where one of two fields are required

    Hi

    I have a form where I would like one of two fields mandatory to fill.

    I have an encryption password field and a pen drive password field. I would it so when the user tries to close the form, one of these two fields has to be filled in.

    How would I acheive this?

    Any help will be much appreciated

    Thanks

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You could use:
    Code:
    If Nz(Me.Field1.Value, "") = "" And Nz(Me.Field2.Value, "") = "" Then
        ' 
        ' Do something when both controls are empty.
        '
    Else
        ' 
        ' Do something when one of the control is not empty.
        '
    End If
    Have a nice day!

  3. #3
    Join Date
    Sep 2011
    Posts
    28
    Fantastic Sindho.

    Works perfectly!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •