Results 1 to 6 of 6
  1. #1
    PDilly is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    78

    Correct event needed to populate text box by tabbing to it (or from it)

    I have 3 text boxes; start date, end date and alternate end date. Start & end are bound to table fields. alternate is unbound

    the tab order is start, alternate end and end dates

    the start date is enterered with a date picker and presently i'm using the got focus event of end date to populate the end date box with this code:

    If IsNull(Alt_date) Then
    Me.end_date = "31/08/" & Year(Now) + 1
    Else
    Me.end_date = Alt_end_date
    End If

    The code allows an alternate end date to be left blank or entered. if there is no entry, the default date from the code is used.

    by using the got focus event, the user has to click on the end box to get it to populate.

    can it be populated just by tabbing to it from the alt end date box? Or even by tabbing on to the next box

    I'm sure it's simple, I've just lost the plot!!



    any help welcome

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    sounds like you want the exit and/or enter events. Maybe this will help you decide
    https://support.office.com/en-us/art...7-ce86553682f9
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    PDilly is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    78
    Quote Originally Posted by Micron View Post
    sounds like you want the exit and/or enter events. Maybe this will help you decide
    https://support.office.com/en-us/art...7-ce86553682f9
    Thank you Micron for the link. I’m sure I can find a solution from it.

    On reflection I think I should test out a different tab order by swapping the end date fields so that the default end date populates first anyway, but is overwritten if an entry follows in the alt end date field. After a night’s sleep that seems a more logical approach and has definite input or no input as an event handler rather than tabbing past the fields.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Don't get why you want 3 fields for 2 dates. why not
    - user picks date
    - after update fires and end date value (bound) is set per your code
    - user wants some other date? then just pick one as was done in the other field
    - that's all, folks!

    All you need to do in the event that uses these dates is to ensure 2 of them are there, which you're probably already doing

  5. #5
    PDilly is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    78
    Quote Originally Posted by Micron View Post
    Don't get why you want 3 fields for 2 dates. why not
    - user picks date
    - after update fires and end date value (bound) is set per your code
    - user wants some other date? then just pick one as was done in the other field
    - that's all, folks!

    All you need to do in the event that uses these dates is to ensure 2 of them are there, which you're probably already doing
    Now that’s what I call obvious!!

    many thanks Micron
    PD

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    you're welcome - hope that helps.

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

Similar Threads

  1. Replies: 13
    Last Post: 09-10-2015, 03:37 PM
  2. auto populate text field with info help needed
    By crombiecrunch in forum Access
    Replies: 4
    Last Post: 02-15-2015, 12:32 PM
  3. Replies: 5
    Last Post: 09-12-2014, 06:41 AM
  4. Replies: 3
    Last Post: 01-18-2014, 02:20 PM
  5. Replies: 3
    Last Post: 05-25-2010, 02:16 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