Link to home
Start Free TrialLog in
Avatar of COPUSER
COPUSER

asked on

VBA does not recognize listview intellisense

Hello,

I have a form with various controls, including ListView. When I create an event handler in code, some of the controls aren't recognised, I get no Intellisense menu of the properties, and a 'Object doesn't support this property or method' error when I run the form. The code compiles without any complaint. I've tried 1) re-register the component (MSCOMCTL.OCX), repair the database, repair the Access application, copied the form to another name, copied the form to another Access database, etc.  Nothing worked.  Can anyone help?  P.S. I need to use ListView control.
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Do this:

Set the Name property of the ListView control to say ... myListView

Then do this:

Option Compare Database
Option Explicit
Dim myListView As ListView


Private Sub Form_Load()
  Set myListView = lstViewA
  myListView.BackColor = RGB(255, 0, 0)            ' Intellisense will now work here
End Sub

mx
*** SORRY ... typo ... wrong Name .....

*** Set the Name property of the ListView control to say ... lstViewA       .... not myListView
                                                                                      ------^^^^^^^^^^

mx
Avatar of COPUSER
COPUSER

ASKER

Thanks for quick response, DatabaseMX.

I made the changes you've mentiioned.  Now, I see the intellisense methods and properties.  However, when I run the code, I get the error 'Type Mismatch" error on the line:  

Set myListView = lstViewA

Any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of COPUSER

ASKER

Now that I have put down the fire, can you explain why did this happen?  This is my first time, but will something like this occur more frequently?
"Can you explain why did this happen? "

Why did what happen ?
Avatar of COPUSER

ASKER

The sudden loss of intellisense for ActiveX components.  Before, you can add an activex control on a form and be able to see the intellisense work right away.  I've read several ExpertsExchange questions that were similar to the problem I was having, but I could not find any definitive answer why.
I have never been able to get it to work other than the way I showed.

mx