Results 1 to 5 of 5
  1. #1
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149

    cannot tab stop to textbox

    I have a combo PayBy (TabIndex=4)a textbox AccountNo (TabIndex=5) and a combo Currency (TabIndex=6).
    All are Locked=No, TabStop=Yes.
    Code:
    Private Sub PayBy_LostFocus()
      If Me.PayBy="Bank" Then
        Me.AccountNo.Enabled=True
      Else
        Me.AccountNo.Enabled=False
      End If
    End Sub
    No matter what I select in the PayBy, when I press the Tab key, it always go to Currency.
    However, the AccountNo will be enabled or disabled according to above coding.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    What is the RowSource of PayBy?

    Set a breakpoint and step through code. What is value of PayBy?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    PayBy.RowSource=SELECT CodeValue FROM SysCode WHERE CodeType="PAYBY"

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    I think issue is LostUpdate event. When this code runs, the focus is already on Currency. Add a line to the True block

    Me.AccountNo.SetFocus
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    what is the default enabled status of accountNo? (i.e. as set in design view ). If not enabled, try enabling it

    Might be better than rather using code, use conditional formatting to disable if PayBy="Bank"

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

Similar Threads

  1. Replies: 3
    Last Post: 02-01-2018, 03:10 AM
  2. Replies: 2
    Last Post: 12-22-2015, 09:09 PM
  3. VBA code stop adding value when textbox exceed 50
    By Georgi in forum Programming
    Replies: 7
    Last Post: 09-27-2013, 02:32 PM
  4. Replies: 2
    Last Post: 04-20-2013, 03:37 AM
  5. Replies: 2
    Last Post: 11-29-2009, 12:00 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