Hi,

I got this code online but can't get it to work! Can someone please help?

It should allow a simple Drag and Drop text from one text box to the other on a form, not sure why this does not work?
In VB6 there was good feature of using e.g. List Control mouse events to Drag Drop items from one List box to other while change the picture could be changed to a "Man" to show drag was being carried out. Is there something similar in MS Access?

Option Compare Database


Const Mouse_Down As Integer = 1
Const Mouse_Up As Integer = 0
Dim MouseState As Integer
Dim FromControl As Control
Dim ToControl As Control


Private Sub UpdateMouse(CurrentControl As Control, Button As Integer)


If Button = Mouse_Down And MouseState = Mouse_Up Then

MouseState = Mouse_Down
Set FromControl = CurrentControl
Me.Refresh

End If

If Button = Mouse_Up And MouseState = Mouse_Down Then

MouseState = Mouse_Up
SwapElementBasics FromControl, CurrentControl
Me.Refresh

End If



End Sub


Private Sub SwapElementBasics(FromControl As Object, ToControl As Object)


If FromControl.Name = "Text1" And ToControl.Name = "Text2" Then

Text2.value = Text1.value
Text1.value = ""

End If

If FromControl.Name = "Text2" And ToControl.Name = "Text1" Then

Text1.value = Text2.value
Text2.value = ""

End If


End Sub


Private Sub Form_Load()
DoCmd.SetWarnings (False)
End Sub


Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)


UpdateMouse Me.Text1, Button

End Sub


Private Sub Text2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)


UpdateMouse Me.Text2, Button


End Sub