Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automation type not supported in VB (Access 2000)

    I have a function in VB which works fine, but when trying it in Access I get the error below:

    Automation type not supported in VB

    It may be that the function in question isnt supported in Access, or it maybe that I need a small change but as yet I havent found anything on the internet to suggest either. My code is below:

    Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer

    Public Function GetKeyStateBool(ByVal lKey As KeyCodeConstants) As Boolean
    Select Case GetKeyState(lKey)
    Case -127, -128
    GetKeyStateBool = True
    End Select
    End Function

    The function is used to select multiple rows of a grid using the shift key (i.e. click on row 2, then hold shift and click on row 8 and all are highlighted).
    Any help would be much appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automation type not supported in VB (Access 2000)

    Replace As KeyCodeConstants with As Long in the function definition.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automation type not supported in VB (Access 2000)

    I thought it might be something wrong with KeyCodeConstants as it wasnt defined anywhere, but I couldnt work out what it was.

    Thanks for providing the answer Hans, and so quickly too! It works like a treat now.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automation type not supported in VB (Access 2000)

    KeyCodeConstants should be defined (it is the enumerated list of codes such as vbKeyA), but it can't be used as a type in ... As KeyCodeConstants.

Posting Permissions

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