Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Nested Ifs (Access 2000)

    How can i nest another if clause in the folloiwng code:

    If IsNull(Me.Quantity) Then
    MsgBox " you must choose a quantity", vbCritical
    Cancel = True
    DoCmd.GoToControl "productid"
    DoCmd.Beep
    DoCmd.Beep
    ClearForm
    Exit Sub
    End If



    I want to add the folloiwng condition namel:

    The above If clause will be valid only when

    Parent!CustomerID is not = 123


    I tried with 2 Ifs but i got them confused.Shall i use

    Select case instead ?

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Nested Ifs (Access 2000)

    Is this what you are looking for

    IF Parent!CustomerID is not = 123 then
    If IsNull(Me.Quantity) Then
    MsgBox " you must choose a quantity", vbCritical
    Cancel = True
    DoCmd.GoToControl "productid"
    DoCmd.Beep
    DoCmd.Beep
    ClearForm

    Exit Sub

    End If

    END IF

    If I understood correctly, that should do what you are looking for.
    Richard

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Nested Ifs (Access 2000)

    You can try

    If IsNull(Me.Quantity) And Me.Parent!CustomerID <> 123 Then

  4. #4
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Nested Ifs (Access 2000)

    I tried it sucessfully.Thank you for the excellent solution.Will you help with me with my next thread/Because it is tied up with this one

Posting Permissions

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