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.
COPUSERAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
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
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
*** SORRY ... typo ... wrong Name .....

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

mx
0
COPUSERAuthor Commented:
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?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
standby ...

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Here you go ...


Private Sub Form_Load()
  Set myListView = lstViewA.Object                       ' add dot  Object  
  myListView.BackColor = RGB(255, 0, 0)

End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
COPUSERAuthor Commented:
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?
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"Can you explain why did this happen? "

Why did what happen ?
0
COPUSERAuthor Commented:
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.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
I have never been able to get it to work other than the way I showed.

mx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.