Results 1 to 2 of 2
  1. #1
    jlawson258 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    9

    need help with a macro to display a message, end all processing and set the focus to a field

    I need to create a macro that will run when a field is blank when the lost_focus action runs. I have a macro that displays a message box, and runs the cancelevent action. However I can't seem to get the focus to go back to the field we just left. The field is on a sub_form.



    Any help would be greatly appreciated.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Most of us here don't use macros, favoring code instead. Your issue is probably how you're referencing the control in question. Using the builder will pretty much get it right all the time, or you can try to figure out how to apply the syntax to reference subform controls:

    Forms!YourFormName.yourSubformControlName.Form.NameOfControlHere

    SubformControlName is the name of the control that contains the subform. It might be the same name as your subform (if you used a wizard) but I do not allow that.
    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. Display a field value in Message Box text.
    By sheusz in forum Programming
    Replies: 2
    Last Post: 06-11-2019, 10:01 PM
  2. Message Box Display if Field is Null
    By dhicks in forum Forms
    Replies: 19
    Last Post: 07-14-2017, 01:54 PM
  3. Replies: 9
    Last Post: 05-23-2017, 11:56 AM
  4. Replies: 3
    Last Post: 10-20-2016, 09:56 AM
  5. Replies: 4
    Last Post: 06-04-2015, 01:07 PM

Tags for this Thread

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