Results 1 to 10 of 10

Thread: Tab key

  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: Tab key

    I have a question, we have access database, there is date field that is set to automatically display current date. But now they would like to change the date, but if i use the mouse to go to the next field, it showed the date i changed. But if i use the tab key, it will change back to the current date. How can i fix it. It is interesting. Thanks.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Try looking at putting the evens OnEnter or OnExit.
    Clicking the object gives it focus - and I presume this is where your event runs.

    - GeorgeV
    George
    Home | Blog

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    One more need to mention, they would like to keep the date that they changed on next record. Is it possible as the date is automatically displayed the current date? They want to keep the date until they need change back the date to be current date.
    Thanks.

  4. #4
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Sounds like there is a "default value" setitng on that field. What you do depends on where the default value is coming from: the table or the form control.

    You can use a bit of code to do what ever you want; are you familiar with coding?

    ts

  5. #5
    Join Date
    Mar 2004
    Posts
    660
    Yes, we use default value in table. I am not familier with code. Can you give me an advice. It needs to be changed soon. Thanks.
    Last edited by yyu; 02-15-07 at 13:29.

  6. #6
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    1) Change the value, press tab and the value changes back.

    Sounds like there is something else the matter here. Under normal circumstances, when the value of bound control is changed, once the focus leaves the control, that value is the "new" value for that control (the old value, known as the "dirty value" is also retained). Once the record updates (generally by changing to a different record), all the new values are written and the old values are gone (the record is now "clean").

    If pressing the tab key results in the old value being reinstated, then some other process is changing the value back (revert, dirty, undo, locked, after update, before update, etc.)

    2) Change the value and have this value become the new default value in subsequent records (presumably for the particular session only).

    The easiest way to do this is to put a default value on the control after it is changed - the form's default over-rides the table's default, but the table's default is restored the next time the form is opened.

    On your date control, add an After_Update event with code similar to this:
    Code:
    Private Sub txtDate_AfterUpdate()
    
        Me.txtDate.DefaultValue = "#" & Format(Me.txtDate.Value) & "#"
    End Sub
    Have fun,
    tc

  7. #7
    Join Date
    Mar 2004
    Posts
    660
    Thanks. It is great. I really have fun here. Thanks a lot.

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I have a thought...

    Why don't you take that field out of the tab order - so a user CANT tab into it... And can only click.

    - GeorgeV
    George
    Home | Blog

  9. #9
    Join Date
    Mar 2004
    Posts
    660
    Yes, it could be a solution. As our users used to use the tab key. They don't like to change. They use the tab key all the time even don't use the mouse for data entry.

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Then disable clicks?
    Nahh, I guess you have your solution.
    It just came to me all of a sudden and I felt the need to post!
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •