OLEDragDrop Problem in Access

leo.clifton

Registered User.
Local time
Today, 16:35
Joined
Jul 31, 2013
Messages
10
Hello

I am trying to incorporate an OLEDragDrop procedure into a VBA form which is part of an Access database. When I try to select the OLEDragDrop event from a Listview object I get an error "User-Defined type not defined".

When I have entered the following code manually:

Listview1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
MsgBox Data.Files.Item(1)
End Sub

I get a compile error when I try to run the form for the same reason.

The object works fine in Excel but in Access I don't seem to be able to use this part of the listview. Does anyone know any way around this as I need to use it in Access rather than Excel?(On a side note, how do you add standard controls to the toolbox in the Access version of Visual Basic, 'Additional Controls' does not appear in the right click menu so I'm currently having to create objects in excel forms, export and then import to Access in order to use things like Listview and Treeview)
 
If you are using Access 2007 or later, in the ribbon to the right of the control selector there is a scroll bar with an additional down arrow at the bottom, click on this and it will show all the options - you should find listview and tree view under the ActiveX controls in the Microsoft area of the list
 
Thanks for that info. I've managed to add the control to the toolbox but now have another problem; every time I try to insert the control into a form (within Visual Basic) it shuts Access 2010 down. I'm getting the standard "Microsoft Access has encountered a problem and needs to close. We are sorry...". After reloading the repaired database the same problem occurs.

I tested it in a brand new database to see if it was a problem with my existing one and the same problem occurred. Any ideas?
 
Have you tried doing Compact & Repair after editing the toolbar options?

Try importing all objects into a brand new database and see if the problem persists..
 
Hi Pr2

Just tried the compact and repair to no avail. I've also tried to add the control in a brand new database with a brand new form (no relation to the old database).
 

Users who are viewing this thread

Back
Top Bottom