Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2022
    Posts
    17

    VBA to stop tabbing pass an important field

    Hi, Not sure if I am in the right forum, but if someone could help it would be most appreciated!


    I have a Field named Operator1, don’t want someone to tab passed this field. I would like to write a VBA code that would not let me pass the Operator1 field unless inputted and offer a message i.e. ‘This field needs to be entered’ Do so now? OK (button).

    Frank

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    The bigger problem is how to ensure they Tab into the field.

    If you must have an entry in a particular text box the only place to Guarentee to capture the data being there or not is in the FORMS Before Update event.
    There is an excellent article here describing form validation and controlling bad data entry:
    https://www.access-programmers.co.uk...ness-1.324342/
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Users can mouse click into a field that is "later" in the tab order, so controlling tab key movement is not of much use? If you really had to do this, you'd need to examine whether or not that field has a value for each enter or gotfocus event for every form field after that one.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,281
    Make that control the focussed control on form load?
    Then validate it before you move to the next control.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Make that control the focussed control on form load?
    Then validate it before you move to the next control.
    Assume the road block is the 5th field (assuming one can even say that). Request would allow 4 prior fields to be filled in, but nothing from 6 on until 6 is populated. That suggestion would make the 1st 4 incapable of being populated. If that's not an issue, then your idea would probably be the simplest.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Important help with a field
    By noahtomlin in forum Access
    Replies: 5
    Last Post: 11-11-2019, 09:27 AM
  2. How to highlight all text when tabbing to a field
    By Allen Sundholm in forum Forms
    Replies: 3
    Last Post: 07-27-2019, 07:56 PM
  3. How important IS referential integrity?
    By IncidentalProgrammer in forum Database Design
    Replies: 9
    Last Post: 07-22-2015, 04:20 PM
  4. Replies: 9
    Last Post: 05-15-2012, 01:57 PM
  5. Replies: 2
    Last Post: 11-29-2009, 12:00 PM

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