Enter Key Behavior... is there more?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jvwhittaker
    New Member
    • Feb 2008
    • 3

    Enter Key Behavior... is there more?

    Hi, I'm using XP, and am trying to control the enter and tab keys within a form. I have used the Enter Key Behavior function within Access, it does very little for me though. What I am trying to do is:
    a. when the enter key is pressed, goto next record. It does this but only to the same field in the next record, not the tab 0 field.
    b. when the enter key is pressed and the field isnull, goto a different control.
    I have tried key up, down and press, as well as other functions.
    thanks, any assistance is greatly appreciated.
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    On getting your focus to go back to tab 0 you will need to just use a .SetFocus property on that control at the end of the code you are using for that event.

    For your second problem, I'm not clear on what the actual error is you are getting or problem you have. Are you saying if there is a null field in your record you want it to proceed to the next record?

    That should be able to be capture with a if isNull(MyField) condition, then just do a .MoveNext under that.

    Comment

    • jvwhittaker
      New Member
      • Feb 2008
      • 3

      #3
      thanks jeffstl,

      these are valid solutions, but not what I'm after.

      What I think I need is Access to goto a new record when enter key is pressed within any of a record's 15+ fields. Tab still needs to go to the next field.
      The other is when the enter key is pressed in a specific field and it is null, I can send the cursor to another control. Basically if I hit enter on my keyboard twice, I go to a different subform tab 0 control waiting for input. Double enter again I'm further along the trail..... I don't think it's a readily available function of the field or form but an enter Key Behavior modification?

      Originally posted by jeffstl
      On getting your focus to go back to tab 0 you will need to just use a .SetFocus property on that control at the end of the code you are using for that event.

      For your second problem, I'm not clear on what the actual error is you are getting or problem you have. Are you saying if there is a null field in your record you want it to proceed to the next record?

      That should be able to be capture with a if isNull(MyField) condition, then just do a .MoveNext under that.

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        This code will set the focus on a particular control every time you move to a different record.

        [CODE=vb]Private Sub Form_Current()
        YourTextboxName .SetFocus
        End Sub
        [/CODE]


        The other part of your question is a little murky. You want hitting <Enter> to take you to the next record and you want hitting <Enter>, when the current textbox is empty, to take you top another control, rather than to another record?

        Welcome to TheScripts!

        Linq ;0)>

        Comment

        • jvwhittaker
          New Member
          • Feb 2008
          • 3

          #5
          thanks missingling,

          this does go to the field perfectly, but I think I need to go to a new record. And then part 2 is if I hit enter again and it is null go to another control, if not null a new record. I tried form_current goto new record, but it loops itself. A short example is I have a photo and I can put a number in a size field 5x7, 6x4 etc... as I tab across the different sizes I can either leave it blank or put in a number. At any time in that record, when I hit enter I want to go to a new recored, I then can enter a new photo or if I hit enter again I want to go to another control ie Frames. thank again

          Originally posted by missinglinq
          This code will set the focus on a particular control every time you move to a different record.

          [CODE=vb]Private Sub Form_Current()
          YourTextboxName .SetFocus
          End Sub
          [/CODE]


          The other part of your question is a little murky. You want hitting <Enter> to take you to the next record and you want hitting <Enter>, when the current textbox is empty, to take you top another control, rather than to another record?

          Welcome to TheScripts!

          Linq ;0)>

          Comment

          Working...