tab using control tabindex

munna

New member
Local time
Tomorrow, 05:08
Joined
Feb 18, 2014
Messages
1
Hi all, need your help on fixing some issue in my access form. I have a user form with multiple controls,like 4 textbox linear to each checkbox. when the checkbox control is checked it should move to next tab index (which is the textbox). until last week i was able to do this with Sendkeys function in VBA, but now my pc is migrated to windows 7 and i read online that windows 7 does not support sendkeys function.

i tried below code but it takes too long till it tab to next control.:banghead:

Dim ctl As Control
Dim currenttab, test As Long
currenttab = Forms!formname.ActiveControl.TabIndex
For Each ctl In Forms!Tracker!TabCtl0
If ctl.ControlType = acTextBox Then
If ctl.TabIndex = currenttab + 1 Then
ctl.SetFocus
Exit For
End If
End If

Next ctl



Can someone please suggest any alternative code or logic for this.
 
Why not just set the focus in each checkbox's AfterUpdate event?

Code:
Private Sub cmdMyCheckbox_AfterUpdate()
    If Me.MyCheckbox Then
        Me.MyControl.SetFocus
    End If
End Sub
 
That's odd because I just tried using SendKeys "{TAB}" on my PC, running Windows 7 and Access 2010, and it moved the cursor to the next field.


ETA:
Doing a bit of reading it would appear to be something to do with UAC (User Account Control) it could turn out to be an intermittent problem depending how the user is set up.

Replacing it with some other way of moving the cursor would probably less troublesome , for you, in the future.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom