[AccessD] A2010: vbBackspace or vbKeyDelete not recognised

Darren - Active Billing darren at activebilling.com.au
Tue Nov 20 20:03:19 CST 2018


And...ignore me

I used Len() minus 1 to resolve it

Actual code if anyone is interested:

Private Sub cmdBackSpace_Click()
On Error Resume Next
Dim strText As String
strText = Left(txtDisplay, Len(txtDisplay) - 1)
txtDisplay = strText
End Sub

Many thanks.
 
Darren


On 21/11/18, 11:19 am, "AccessD on behalf of Darren - Active Billing" <accessd-bounces at databaseadvisors.com on behalf of darren at activebilling.com.au> wrote:

    Hi Team,
    
     
    
    Just writing a simple touch pad/num pad for entering numbers into a field (For a Touch screen POS app – No mouse/keyboard interactions)
    
     
    
    Found some code on the ‘nets and it’s working nicely for the most part except for Backspace/Delete.
    
     
    
    12 Buttons on the screen – All assigned 0 through to 9 and one for “Enter” and one for “Backspace/Delete”. Simple enough.
    
     
    
    Here’s the code
    
     
    
    Option Compare Database
    
    Option Explicit
    
     
    
    Private Sub TypeAlphaNum(intKeyCode As Integer)
    
        Screen.PreviousControl.SetFocus
    
        Me.txtDisplay.Value = Me.txtDisplay.Value & Chr(intKeyCode)
    
    End Sub
    
     
    
    Private Sub cmd0_Click()
    
        TypeAlphaNum vbKey0
    
    End Sub
    
    Private Sub cmd1_Click()
    
        TypeAlphaNum vbKey1
    
    End Sub
    
    Private Sub cmd2_Click()
    
        TypeAlphaNum vbKey2
    
    End Sub 
    
     
    
    And so on for all keys/buttons.But it fails in the on click of the Key assigned for vbBackSpace 
    
     
    
    I have also tried vbKeyDelete too – this one just adds dots to the ‘display’ 
    
     
    
     
    
    The line below just errors out – Compile Error Variable Not Defined
    
     
    
    Private Sub cmdBackSpace_Click()
    
        TypeAlphaNum vbKeyBackspace
    
    End Sub
    
     
    
    Have also tried
    
     
    
    Private Sub cmdBackSpace_Click()
    
        Dim vbKeyBackspace  as integer
    
    TypeAlphaNum 8  ‘and various other combinations of numbers
    
    End Sub
    
     
    
     
    
    And this just adds dots at the end of the display
    
     
    
    Private Sub cmdBackSpace_Click()
    
        TypeAlphaNum vbKeyDelete
    
    End Sub
    
     
    
    Any suggestions?
    
     
    
    Many thanks in advance.
    
     
    
    Darren
    
    -- 
    AccessD mailing list
    AccessD at databaseadvisors.com
    http://databaseadvisors.com/mailman/listinfo/accessd
    Website: http://www.databaseadvisors.com
    





More information about the AccessD mailing list