Over the past several years myself and a couple of others have posted
code enabling you to simulate dragging of Access lightweight(no
permanent DC) controls. Did you try a GoogleGroups search?
Here's some code to get you started but I'm sure I have seen more
polished code posted. The sample code uses a TextBox but it will work
for an Image control as well.
From: Stephen Lebans (nospam)
Subject: Re: Dragging controls at run-time
View this article only
Newsgroups: microsoft.public.access.forms
Date: 1999/12/22
Hi Ron,
you'll need to add some code to stop the user from trying to place the
control "outside" of the Form, so add some clipping boundary code. It's
time for bed so I haven't tested this much but it seems to work. Jeeze
you must have got a headache looking at that sample code you posted. I
thought I was back in the 80's for a moment there!<bg>
Option Compare Database
Option Explicit
Private mintOffsetX As Integer
Private mintOffsetY As Integer
Private mfMouseDown As Boolean
Private blFlag As Boolean
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
With Text1 'Me.ActiveControl
.Locked = True
mintOffsetX = X - .Left
mintOffsetY = Y - .Top
End With
DoEvents
mfMouseDown = True
End Sub
Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If blFlag = True Then Exit Sub
blFlag = True
If mfMouseDown = True Then
With Text1 'Me.ActiveControl
.Left = .Left + X ' - mintOffsetX
.Top = .Top + Y '- mintOffsetY
End With
End If
DoEvents
blFlag = False
End Sub
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
mfMouseDown = False
Me.Text1.Locked = False 'Me.ActiveControl.Locked = False
End Sub
HTH
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.