Click any image to view a larger version



Version 2.1                 First Published 30 July 2022

Section Links:     Introduction     Designing for Tablet Use     Example App     Additional Info


Introduction                                                                                                                   Return To Top

I have been running Access on a Windows tablet PC for several years.
Currently I use a 12-inch (30cm) tablet with 4GB RAM which runs Windows 10 Home 64-bit with Office 365 64-bit.
It is sufficiently powerful for most Access apps. It has a detachable keyboard but I very rarely use it.

Previously I used a 10 inch (25cm) tablet with 2 GB RAM on which I installed 32-bit Access 2010.
The screen was a bit small but Access apps still ran though processing was slow.

Back in May 2018, I wrote the following in a thread at Access World Forums: Using Access on a Windows tablet

Access isn't designed for touch screens though hopefully it will be in the future.
When I first used Access on a tablet PC, I found it worked well with one important exception.

At that time, the Visual Basic Editor (VBE) opened with no menu bar or toolbars.
That limited its use for editing code significantly.

After several fruitless hours adding code in the Immediate window to try & trigger the menu bar & toolbars to appear, uninstalling & reinstalling, I found the answer by trial & error – it was a tablet mode issue

Switch off tablet mode and the menu bar & toolbars appear
Switch it back on & they're still in place whilst Access remains open.
Restart Access in tablet mode & they're gone again

A very irritating glitch but at least I had a work-round
I reported this via the Feedback hub



To my surprise, the issue was fixed reasonably quickly (at least in Access 365).

Nowadays, most of my commercial and example databases will run successfully on a tablet and a few are specifically designed for tablet use.
For example:
      Patient Login (Kiosk Mode)
      A Kiosk Style Application

These days I not only answer most forum posts using my tablet, I also check most of the downloaded Access apps on the tablet in touch screen mode using the on-screen tablet keyboard. There is usually no need to connect the portable keyboard that came with it. Mostly that works well.

However, in some cases, the design of downloaded database apps makes tablet use impossible.

For example, if the controls are small and close together.
Similarly if the forms are maximised with no navigation pane or ribbon.
Whilst removing the navigation pane & ribbon works fine in a completed database, its a total PITA when trying to fix the problems described in the forum thread.



Designing Apps for Tablet Use                                                                                     Return To Top

For best results when designing apps which may be used on a tablet, I suggest you do the following:

1.   Use automatic form resizing so forms display properly on any size/shape/resolution screen from tablet up to around a 22-inch monitor.
      See Automatic Form Resizing Tutorial

2.   Ensure the form design has controls that aren't too close together and are large enough for touch screen use.
      For example, see Patient Login

PatientLoginMonth
3.   Minimize the need for keyboard entry as far as possible e.g. using combos or listboxes to select items.
      Where keyboard entry is necessary, a zoom box can be used so the on-screen keyboard (OSK) doesn't block the textbox.
      Of course, the OSK can be dragged around the screen if needed
      See forms 1-3 in Accurately Move Forms & Controls

      Two on-screen keyboards are available:

      a)   Accessibility keyboard (OSK.exe)

OSK
            For anyone still using Windows Vista, this has its own on-screen keyboard:

VistaOSK
      b)   Tablet keyboard (TabTip.exe)
            The appearance depends on whether Windows is set to light or dark mode. It is supplied with several possible options including:

            i)  A simplified keyboard with most commonly used keys

TabTips1
            ii)   An extended keyboard with additional keys

TabTips2
            iii)   A whiteboard for handwritten input
                  This is automatically converted to text, usually with reasonable accuracy

Whiteboard
            iv)   Dictation mode

Dictation
                  Although not fully supported in Access, I have found that dictation works well in long text (memo) fields



Example App                                                                                                                   Return To Top

I have created a simple example app which can be used to test the use of each of these on-screen keyboards in an Access application.

Main form:

MainForm
Text input form with the accessibility keyboard (OSK.exe):

FormOSK
Text input form with the tablet keyboard (TabTips.exe):

FormTabTips
NOTE:
The code has been designed so that both versions of the on-screen keyboard should popup automatically whether or not you are using a tablet PC.

However over the years, Microsoft have changed the conditions needed for the older accessibility keyboard (OSK.exe) to appear.
If you experience issues, you can enable it from Windows Settings . . . Ease of Access . . . Keyboard. Alternatively click Win + Ctrl + O to toggle it on/off.

AccessibilityKeyboardSettings

The code used to show/hide each of the on-screen keyboards has been updated so it works in both 32-bit & 64-bit Access with the latest Windows settings (as of July 2022).
The code is in a standard module modShellEx

CODE:

Option Compare Database
Option Explicit

'###############################################

API declarations
#If VBA7 Then       '32/64-bit A2010 or later
      Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
            (ByVal hwnd As LongPtr, _
            ByVal lpOperation As String, _
            ByVal lpFile As String, _
            ByVal lpParameters As String, _
            ByVal lpDirectory As String, _
            ByVal nShowCmd As Long) _
            As Long
#Else       A2007 or earlier
     Private Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" _
           (ByVal hwnd As Long, _
           ByVal lpOperation As String, _
           ByVal lpFile As String, _
           ByVal lpParameters As String, _
           ByVal lpDirectory As String, _
           ByVal nShowCmd As Long) _
           As Long
#End If

'###############################################

Dim lngPtr As Long

'Call Wow64DisableWow64FsRedirection prior to calling ShellExecute and Wow64RevertWow64FsRedirection immediately after (32-bit ONLY).
'Disables file system redirection for the calling thread. File system redirection is enabled by default.

#If VBA7 Then
      Private Declare PtrSafe Function Wow64DisableWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
      Private Declare PtrSafe Function Wow64RevertWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
#Else
      Private Declare Function Wow64DisableWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
      Private Declare Function Wow64RevertWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
#End If

'=====================================================

Public Function RunOSK()

'Colin Riddington - Mendip Data Systems
'Updated 21/06/2021

'opens on screen keyboard if opened in tablet mode
'For testing on a standard PC, the 'If ...End If' have been disabled

'NOTE: Settings have changed in recent years
'Call Wow64DisableWow64FsRedirection prior to calling ShellExecute and Wow64RevertWow64FsRedirection immediately after (32-bit only).

'Alternatively enable in Windows Settings ...Ease of Access...Keyboard
'OR just press Win+Ctrl+O

'If modMetrics.System(SM_TABLETPC) Then
      #If Win64 Then
            ShellExecute 0, "open", "osk.exe", vbNullString, "c:\", 1
      #Else
            Call Wow64DisableWow64FsRedirection(lngPtr)
            ShellExecute 0, "open", "osk.exe", vbNullString, "c:\", 1
            Call Wow64RevertWow64FsRedirection(lngPtr)
      #End If
'End If

End Function

'=====================================================
Public Function HideOSK()

      'hides the on-screen keyboard
      Call Wow64DisableWow64FsRedirection(lngPtr)
      ShellExecute 0, "open", "tskill", "osk", "", vbHidden
      Call Wow64RevertWow64FsRedirection(lngPtr)
End Function

'=====================================================

Public Sub ShellEx(ByVal Path As String, Optional ByVal Parameters As String, Optional ByVal HideWindow As Boolean)

      If Dir(Path) > "" Then
            ShellExecute 0, "open", Path, Parameters, "", IIf(HideWindow, 0, 1)
Else
            MsgBox "Can't find application"
      End If
End Sub

'=====================================================

Public Function OpenTabTip()

'Colin Riddington - Mendip Data Systems
'18/09/2018

'opens tablet screen keyboard in tablet mode
'For testing on a standard PC, the 'If ...End If' have been disabled

'If modMetrics.System(SM_TABLETPC) Then
      #If Win64 Then
            ShellEx "C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe", , True
      #Else
            Call Wow64DisableWow64FsRedirection(lngPtr)
            ShellEx "C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe", , True
            Call Wow64RevertWow64FsRedirection(lngPtr)
      #End If
'End If
End Function

'=====================================================

Public Function HideTabTip()
      'hides the tablet keyboard
      Call Wow64DisableWow64FsRedirection(lngPtr)
      ShellExecute 0, "open", "tskill", "TabTip", "", vbHidden
      Call Wow64RevertWow64FsRedirection(lngPtr)
End Function



By comparison, the form code is very simple:

Private Sub Form_Load()
      'run check
      CheckOSKStatus
End Sub
'=====================================================

Private Sub CheckOSKStatus()
'checks which on-screen keyboard has been selected
      Select Case Me.OpenArgs
      Case "OSK"
            RunOSK
            Me.lblInfo.Caption = "Running on screen keyboard 'osk.exe'" & vbCrLf & _ "If the keyboard doesn't appear, press Win + Ctrl + O"
      Case "TabTip"
            OpenTabTip
            Me.lblInfo.Caption = "Running tablet keyboard 'TabTip.exe'"
      Case Else
            Me.lblInfo.Caption = "No on screen keyboard in use"
      End Select
End Sub
'=====================================================

Private Sub cmdClose_Click()
      Select Case Me.OpenArgs
      Case "OSK"
            HideOSK
      Case "TabTip"
            HideTabTip
      End Select
      DoCmd.Close acForm, Me.Name
End Sub



      Click to download:       OnScreenKeyboardDEMO_v2.1     (zipped)



Additional Info                                                                                                                 Return To Top

1.   Designing on a tablet isn't ideal as the Access interface isn't completely suited to touchscreen use.
      It is usually better to design Access apps on a PC/laptop and then test it for usability on the tablet

2.   Also its important to remember that if the tablet is wirelessly connected to a backend database, you WILL get corruption issues.
      You need to plan ways around that e.g. download data to the tablet, do your data collection locally, then plug in to the network and upload the new or changed data.





Colin Riddington           Mendip Data Systems                 30 July 2022



Return to Access Articles Page




Return to Top