Results 1 to 14 of 14
  1. #1
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    57

    Tab on Enter

    I have a Form, that I scan in a Bar Code. When I scan the Bar Code, the Form gets an 'Enter' and goes to the next record. I want it to Tab to the next field. I need to disable the Enter and enable a Tab.

    How can I do that?

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Removing the enter could be worked round. By making the form not allowing new records to be added?
    Sendkeys event can be used to "simulate" the tab key be pressed.


    Sent from my iPhone using Tapatalk

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about:
    File>Options>Client Settings>Editing>Move after enter>Next Field

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Each Form also has a Cycle Property on the Other Tab of the Property Sheet.

  5. #5
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    57
    OK, I did Move After Enter, but now I need to get to the next record. Can I change the option in code?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You can move to the next record with code. When do you want to move? Is there an automatic place on your form to go to the next record? Maybe the last control on the form? You could also move to the next record with a button.

  7. #7
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    57
    I found a way to get to a new record.

    Code:
    Private Sub cmdCloseForm_Click()
        DoCmd.GoToRecord , , acNewRec
        Forms!Main.Visible = True
    End Sub
    That works if I tab to the end of the form(Next Button), but fails if I Click the button before the end of the form.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The Command Button wizard can make a Next Record button for you.

  9. #9
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    57
    Here is the code for the Next Record button:

    Code:
    Private Sub Command0_Click()
    On Error GoTo Err_Command0_Click
    
        DoCmd.GoToRecord , , acNewRec
    
    Exit_Command0_Click:
        Exit Sub
    Err_Command0_Click:
        MsgBox Err.Description
        Resume Exit_Command0_Click
        
    End Sub
    This almost works, but I need to move the cursor to the first field in the new record to get the scanner to the right place.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is the "first field" the 1st object in the tab order? What is the name of the "First Field" Control on your form?

  11. #11
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    57
    Yes, it's the first object in the tab order. The name is 'BarCodeID_PK'.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try this:
    Code:
    Private Sub Command0_Click()
    On Error GoTo Err_Command0_Click
    
        DoCmd.GoToRecord , , acNewRec
        Me.BarCodeID_PK.SetFocus
    
    Exit_Command0_Click:
        Exit Sub
    Err_Command0_Click:
        MsgBox Err.Description
        Resume Exit_Command0_Click
        
    End Sub

  13. #13
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    57
    OK, that does it! Thanks.

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad we could help. Enjoy the project.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Field auto enter new line on enter event
    By Ruegen in forum Forms
    Replies: 3
    Last Post: 09-17-2013, 09:00 PM
  2. Enter Parameter Value?
    By IzzyKap in forum Forms
    Replies: 3
    Last Post: 12-21-2012, 08:43 AM
  3. Tab or Enter keys
    By rwatkins in forum Forms
    Replies: 3
    Last Post: 05-11-2011, 03:22 PM
  4. Replies: 5
    Last Post: 02-06-2011, 04:32 PM
  5. Enter Parameter Value
    By T001 in forum Access
    Replies: 1
    Last Post: 08-11-2010, 05:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums