[dba-VB] Create a DLL for Access Drag Drop?

Drew Wutka DWUTKA at Marlow.com
Wed Oct 28 15:29:26 CDT 2009


Close your database, and reopen it.  DO NOT go into any VBA code AT ALL.
See if your procedure works.  It probably should (though I haven't
actually tried your code).  The problem is that when ANY callback
function runs, if the VBE has been opened, it will freak Access out like
crazy!

As for code to use a treeview:

Option Compare Database
Dim tvw As TreeView
Private Sub Form_Load()
Set tvw = Me.TreeView0.Object
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set tvw = Nothing
End Sub
Private Sub TreeView0_OLEDragDrop(Data As Object, Effect As Long, Button
As Integer, Shift As Integer, x As Single, y As Single)
Dim nd As Node
Select Case DetermineDropType(Data)
    Case "TEXT"
        
    Case "FILES"
    
    Case Else
        MsgBox "Invalid Object Type"
End Select
End Sub
Function DetermineDropType(Data As Object) As String
On Error Resume Next
Dim strTemp As String
strTemp = Data.GetData(1)
If Not Err Then
    DetermineDropType = "TEXT"
    Exit Function
End If
Err.Clear
If Data.Files.Count > 0 Then
    DetermineDropType = "FILES"
End If
End Function


In the case 'FILES' you would use something like:

For i=1 to Data.Files.Count
	strPath=DataFiles(i)
	'do something with strpath
Next i

Drew
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Tuesday, October 27, 2009 6:53 PM
To: 'Discussion concerning Visual Basic and related programming issues.'
Subject: Re: [dba-VB] Create a DLL for Access Drag Drop?

Hi Drew,

I'm using Access 2003, and once the code starts running in the 'callback
procedure', Access does go bonkers.  I'm guessing that placing this
procedure into a DLL will solve that.

I found Q209898, which discusses dragging and dropping nodes in a
treeview
control.  I also set up a form and was able to trigger the OLEDragOver
event
and the OLEDragDrop event when I dragged a file across the control.  In
both
there is a Data object argument, which I don't know how to use to get a
file's full path.

Have you been able to get a file's path using a treeview?  What
events/code
did you use?

Thanks!
Dan
The information contained in this transmission is intended only for the person or entity 
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business 
Sensitive material. If you are not the intended recipient, please contact the sender 
immediately and destroy the material in its entirety, whether electronic or hard copy. 
You are notified that any review, retransmission, copying, disclosure, dissemination, 
or other use of, or taking of any action in reliance upon this information by persons 
or entities other than the intended recipient is prohibited.





More information about the dba-VB mailing list