Search results

  1. J

    When "X" is not equal to "X"

    I stand corrected on that point, however <You can set focus on any control as long as it's not disabled.> and visible
  2. J

    When "X" is not equal to "X"

    If a control has focus and you try to setfocus to that control you will get an error. Majp insists on leaving out the "if activecontrol is not the same as new control then change the active control" This is my original code Private Sub isInFocus(str As String) If Me.ActiveControl.Name <> str...
  3. J

    When "X" is not equal to "X"

    I've changed the code to the following and it now works correctly, even with the same value in each combo. You certainly put me on the right track. Private Sub isInFocus(ByRef Ctl As Control) If ActiveControl.Name <> Ctl.Name Then Ctl.SetFocus End Sub John
  4. J

    When "X" is not equal to "X"

    Actually it only appears to work. It returns the contents of the control, not the name. So if I put 1 in each combo there is no change of focus. I tried adding .name to the controls but Access says "Type mismatch". John
  5. J

    When "X" is not equal to "X"

    Thank you. That does exactly what I want, although I did get trapped where there was no active control. I can't use it in a load event but it's fine in the body of the code. I think my original code was somehow unable to distinguish the difference between control.name and a string. Once again...
  6. J

    When "X" is not equal to "X"

    Au contraire. You have left out the comparison. Your code actually does nothing. The code, below from arnelgp mirrors my code but passes the new control instead of a string. Private Sub isInFocus(ByRef Ctl As Control) If Not (ActiveControl Is Ctl) Then Ctl.SetFocus End If End Sub Note the...
  7. J

    When "X" is not equal to "X"

    what I wrote is this, Private Sub isInFocus(str As String) If Me.ActiveControl.Name = str Then Exit Sub <<<<<<<<<<<<<<<<<< Else <<<<<<<<<<<<<<<< Me.Controls(str).SetFocus End If End Sub Not this Private Sub isInFocus(str As String) If Me.ActiveControl.Name...
  8. J

    When "X" is not equal to "X"

    Do you think there is a difference between the active control and the control with focus? Of course not, they are one and the same. What do you think happens if you set focus to a control that already has focus? Obviously you cannot do that Do you want help with you problem, I'm intrigued to...
  9. J

    When "X" is not equal to "X"

    Read what you have just written, you have proven yourself wrong. <<<if cboSpecies does not have focus it now has focus>>> or "if cbotables had focus, cbospecies now has focus" which is exactly the purpose of the sub. The setfocus command will be applied, if, and only if, the currently...
  10. J

    When "X" is not equal to "X"

    That is your interpretation. It is not what I have written. In plain English. If the input to the sub, str, is the same as the name of the active control then the active control stays active. If the input to the sub, str, is NOT the same as the name of the active control then the active control...
  11. J

    When "X" is not equal to "X"

    Read the code. there is no "Else" clause involved. Private Sub isInFocus(str As String) If Me.ActiveControl.Name <> str Then Me.Controls(str).SetFocus End Sub Case1. str = "cboSpecies" me.activecontrol.name = "cbospecies". if me.activecontrol.name <> str then nothing happens...
  12. J

    When "X" is not equal to "X"

    Sounds good but the rowsource for the controls has to be changed to correct for the different inputs. Private Sub btnBot_Click() sBtn = "Bot" Me.btnBot.BackColor = RGB(218, 255, 94) Me.btnCom.BackColor = RGB(180, 199, 231) ClearIt Me.cboGenus.RowSource = "QCommonG"...
  13. J

    When "X" is not equal to "X"

    That's precisely what it's supposed to do. If the active control is the same as the control having setfocus applied then nothing happens, if not the new control becomes the active control. You might need to read the entire post, it's all explained there.
  14. J

    When "X" is not equal to "X"

    It's highlighted because I was stepping through to get the screen shots. I have tried the long version, same result but I haven't tried "by val" The main problem is that it set's focus if the string and control name are the same or not. It's as if the "If" statement is being ignored.
  15. J

    When "X" is not equal to "X"

    In the case that a query only returns one result, the combobox waits to be updated, In this case I call combo_afterupdate which has the effect of the afterupdate event being triggered in the call and, it seems, again after "lostfocus" The idea being if there is only one response, there is no...
  16. J

    When "X" is not equal to "X"

    Me.cboTables.Requery isInFocus "cboTables"
  17. J

    When "X" is not equal to "X"

    I have the following code snippet that refuses to do as it is bid. The idea is to catch an inadvertent "setfocus" to a control that already has focus. From the screenshots it is obvious that the control name and the string "str" are the same yet the "Then" clause is still activated. Private...
  18. J

    Followhyperlink alternate

    I'll give it a try. I ran the code today on two w11 machines and there was no problem other than on one machine the entire software froze after left unattended for a while. Stopped the program with task manager, restarted it and went through the 3D images without a hitch. Somebody once said...
  19. J

    Followhyperlink alternate

    Thank you but no help. The URL has HTTPS:// built in and my problem is not security warnings but a "Mini" crash that fixes itself after clicking OK in the warning.
  20. J

    Followhyperlink alternate

    I just tried it with a couple of short image links with the same result. Debug thinks it's all good but there must be some obscure thing causing it. I'll put some stand alone procedures together and see if I can track it down that way. Once again, many thanks for your input. John
Top Bottom