Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IF IF (A2000 Win98)

    How can I get the following 2 IF statements to work properly

    Further to that, How can I make two IF statements work in the same code:

    Private Sub cmbSearch_LostFocus()
    If IsNull(Me.cmbSearch) Then
    Forms!frmDetails.Requery
    Me.DummyEst.SetFocus
    Me.cmbSearch.Visible = False
    Me.cmbSearchSub.Visible = False
    If KeyCode = vbKeyF3 Then Call Command296_Click
    End If
    End If

    End Sub

    Dave

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: IF IF (A2000 Win98)

    >>If KeyCode = vbKeyF3 Then Call Command296_Click<<

    When you write an IF statement like the one above, you don't use a corresponding "End If". However, I find this makes code very difficult to read, so I always do it like this:<pre>If KeyCode = vbKeyF3 Then
    Call Command296_Click
    end if</pre>

    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: IF IF (A2000 Win98)

    Do you need both of them to be evaluated? Do you only want to run the KeyCode test if Me.cmbSearch is null?

    There's no problem with having more than one If in your code, but it isn't clear what you want to happen. The way you have it written, you will only evaluate the keycode if cmbSearch is null when it loses the focus. There are other problems you may encounter though, because tests for a KeyCode really belong in one of the Key events--KeyPress or KeyDown.

    If you explain what you're trying to accomplish, someone will be able to help you with it.
    Charlotte

Posting Permissions

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