By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

Drag and Drop

P: n/a
Hi everyone,

Has anyone got any experience with drop and drag in Access?

I would like to make a calendar style form where my users can drop and drag
appointments....

I am using Access 2003 and I have access to .net and the like, but I would
really like to keep it simple.

Thank you

Nicolaas
---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004
Nov 12 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
There's no specific support for drag-and-drop in any version of Access
through 2003. Some have simulated it, with varying degrees of success --
none, as far as I know, nearly as smooth and seamless as drag-and-drop in
languages which support it (or use of the APIs that support it).

Larry Linson
Microsoft Access MVP

"WindAndWaves" <ac****@ngaru.com> wrote in message
news:3n******************@news.xtra.co.nz...
Hi everyone,

Has anyone got any experience with drop and drag in Access?

I would like to make a calendar style form where my users can drop and drag appointments....

I am using Access 2003 and I have access to .net and the like, but I would
really like to keep it simple.

Thank you

Nicolaas
---
Please immediately let us know (by phone or return email) if (a) this email contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004

Nov 12 '05 #2

P: n/a
thank you for that answer,

does anyone then perhaps know if you can 'link' into a specific program to
use drop and drag or perhaps that you can link with outlook to drop the data
into the outlook calender????

or who did it with success in access????

I noticed that in the mouseUp, mousedown event, etc... there is information
on the location of the mouse....

You should be able to write a general function that manages these 'pick-ups'
and 'drop-offs'....

keen to hear any further thoughts on this.

Thank you all for your help.

"Larry Linson" <bo*****@localhost.not> wrote in message
news:_H******************@nwrddc02.gnilink.net...
There's no specific support for drag-and-drop in any version of Access
through 2003. Some have simulated it, with varying degrees of success --
none, as far as I know, nearly as smooth and seamless as drag-and-drop in
languages which support it (or use of the APIs that support it).

Larry Linson
Microsoft Access MVP

"WindAndWaves" <ac****@ngaru.com> wrote in message
news:3n******************@news.xtra.co.nz...
Hi everyone,

Has anyone got any experience with drop and drag in Access?

I would like to make a calendar style form where my users can drop and

drag
appointments....

I am using Access 2003 and I have access to .net and the like, but I would really like to keep it simple.

Thank you

Nicolaas
---
Please immediately let us know (by phone or return email) if (a) this

email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004


---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004
Nov 12 '05 #3

P: n/a
Hi
There is a sample at this link
http://www.databaseadvisors.com/down...ragAndDrop.zip

--
____________________________

Sigurd Bruteig
www.made4u.no

"WindAndWaves" <ac****@ngaru.com> skrev i melding
news:3n******************@news.xtra.co.nz...
Hi everyone,

Has anyone got any experience with drop and drag in Access?

I would like to make a calendar style form where my users can drop and drag appointments....

I am using Access 2003 and I have access to .net and the like, but I would
really like to keep it simple.

Thank you

Nicolaas
---
Please immediately let us know (by phone or return email) if (a) this email contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004

Nov 12 '05 #4

P: n/a
On Sun, 9 May 2004 15:30:13 +1200, "WindAndWaves" <ac****@ngaru.com>
wrote:

You would think that MouseUp etc. is all you need, but that is far
from the truth. If the tool lacks the basic support, it is exceedingly
difficult to build it yourself.

I would say this is one good reason to go with VB or .NET

-Tom.
thank you for that answer,

does anyone then perhaps know if you can 'link' into a specific program to
use drop and drag or perhaps that you can link with outlook to drop the data
into the outlook calender????

or who did it with success in access????

I noticed that in the mouseUp, mousedown event, etc... there is information
on the location of the mouse....

You should be able to write a general function that manages these 'pick-ups'
and 'drop-offs'....

keen to hear any further thoughts on this.

Thank you all for your help.

"Larry Linson" <bo*****@localhost.not> wrote in message
news:_H******************@nwrddc02.gnilink.net. ..
There's no specific support for drag-and-drop in any version of Access
through 2003. Some have simulated it, with varying degrees of success --
none, as far as I know, nearly as smooth and seamless as drag-and-drop in
languages which support it (or use of the APIs that support it).

Larry Linson
Microsoft Access MVP

"WindAndWaves" <ac****@ngaru.com> wrote in message
news:3n******************@news.xtra.co.nz...
> Hi everyone,
>
> Has anyone got any experience with drop and drag in Access?
>
> I would like to make a calendar style form where my users can drop and

drag
> appointments....
>
> I am using Access 2003 and I have access to .net and the like, but Iwould > really like to keep it simple.
>
> Thank you
>
> Nicolaas
>
>
> ---
> Please immediately let us know (by phone or return email) if (a) this

email
> contains a virus
> (b) you are not the intended recipient
> (c) you consider this email to be spam.
> We have done our utmost to make sure that
> none of the above are applicable. THANK YOU
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004
>
>


---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004


Nov 12 '05 #5

P: n/a
Hi Tom (goedemorege)

I have a huge database in Access, can I take that into VB??? / .net and if
so how do I go about it????
---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004
Nov 12 '05 #6

P: n/a
The database part can be used pretty much intact, but the user interface
will be almost a total rewrite, no matter whether you use classic VB or
VB.NET. Despite the visual resemblance between forms / screens in classic VB
and Access, the object model is different. There are/were some third-party
products that were designed to assist in an Access-to-VB conversion.

But, is it or will it be worth the time and effort just to get drag and
drop? I've been developing general business applications with Access (single
user, multiuser, and client-server) and never felt severly penalized due to
lack of drag-and-drop. There has always been some other approach that
accomplished the purpose and could be done just using native Access
features.

That is, I've never had a client say, "I want it to do 'X', _and_ I want it
to do it with drag-and-drop."

Larry Linson
Microsoft Access MVP
"WindAndWaves" <ac****@ngaru.com> wrote in message
news:1W*******************@news.xtra.co.nz...
Hi Tom (goedemorege)

I have a huge database in Access, can I take that into VB??? / .net and if
so how do I go about it????
---
Please immediately let us know (by phone or return email) if (a) this email contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004

Nov 12 '05 #7

P: n/a
Here is a post from Felix Lima, a MS Suport Engineer, on Drag and Drop
in Access.

In order to do this effectively in Access, you will need to use
subclassing
and API calls. Subclassing in Access is not really recommended and may
cause significant problems. Q278379 explains some problems with
subclassing:

"Because of problems with subclassing windows after loading the
Microsoft Office Visual Basic Editor,
Microsoft highly recommends that you use Microsoft Visual Basic or
Microsoft Visual C++ to
create an ActiveX DLL, and that you then reference the DLL from your
Microsoft Access
application."

Basically, In order to successfully get this to work, you need to
subclass the window and then call the DragAcceptFiles() API. When the
user drops
files from explorer, the window is sent the WM_DROPFILES message. This
can be accomplished in Access by first creating a VB dll and then
calling
the dll from Access.

I was able to create a VB 6 dll which can be referenced in Access to
successfully get the file path from windows explorer to a textbox on an
access form. (It is a modification of a post by Stoil Marinov in
comp.lang.basic.visual 19/11/1999):

Here are the steps I took:

a) Create a VB6 dll with a module (basDragDrop) and a class
(clsDragDrop)

b) Add the following code to the basDragDrop module:

Option Compare Text
Option Explicit

Public CDrag As CDragDrop
Public lpPrevWndProc As Long
Public Const GWL_WNDPROC = (-4)
Public Const WM_DROPFILES = &H233
Public Const GetNumOfFiles = &HFFFF
Public Declare Function CallWindowProc Lib "user32" Alias _
"CallWindowProcA" (ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Public Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Public Declare Sub DragAcceptFiles Lib "shell32.dll" _
(ByVal hWnd As Long, _
ByVal fAccept As Long)

Public Declare Sub DragFinish Lib "shell32.dll" _
(ByVal hDrop As Long)

Public Declare Function DragQueryFile Lib "shell32.dll" _
Alias "DragQueryFileA" (ByVal hDrop As Long, _
ByVal lFile As Long, _
ByVal lpFileName As String, _
ByVal cbLen As Long) As Long

Public Function WindowProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal
wp
As Long, ByVal lp As Long) As Long
If Msg = WM_DROPFILES Then
'Files have been dropped
CDrag.AcceptDroppedFiles wp
Else
WindowProc = CallWindowProc(lpPrevWndProc, hWnd, Msg, wp, lp)
End If
End Function

c) Add the following code CDragDrop:

Option Compare Text
Option Explicit
Private frm As Object
Private txt As Object

Public Property Set Form(frmIn As Object)
Set frm = frmIn
End Property

Public Property Set textbox(txtin As Object)
Set txt = txtin
End Property

Public Sub SubClassHookForm()

Call DragAcceptFiles(frm.hWnd, 1)

lpPrevWndProc = SetWindowLong(frm.hWnd, GWL_WNDPROC, _
AddressOf WindowProc)

Set CDrag = Me

End Sub

Public Sub SubClassUnHookForm()

Call SetWindowLong(frm.hWnd, GWL_WNDPROC, lpPrevWndProc)

Call DragAcceptFiles(frm.hWnd, 0)

End Sub
Sub AcceptDroppedFiles(hDrop As Long)

Dim lNumOfFiles As Long

Dim lReturn As Long

Dim sFilename As String

Dim lm As Long

'Get the number of dropped files
lNumOfFiles = DragQueryFile(hDrop, GetNumOfFiles, 0&, 0)

For lm = 0 To lNumOfFiles
'Allocate buffer for the name of the file

sFilename = String$(257, Chr$(0))
'Get the name of the file

lReturn = DragQueryFile(hDrop, lm, sFilename, Len(sFilename))

'Add the file name to the list

If lReturn > 0 Then

txt.Text = txt.Text & Left$(sFilename, lReturn) & vbCrLf

End If

Next lm
'Tell Windows to free the memory allocated to store the dropped files
DragFinish hDrop
End Sub

c) Compile the dll in VB

d) Add the following to a form in Access that has a textbox called
Text1
and a reference to the compiled dll above:

Option Compare Database
Option Explicit

Dim CDrag As New CDragDrop

Private Sub Form_Load()

'Subclass the form
Set CDrag.TextBox = Me.Text1
Set CDrag.Form = Me
CDrag.SubClassHookForm

End Sub

Private Sub Form_Unload(Cancel As Integer)
'UnSubclass the form

CDrag.SubClassUnHookForm
Set CDrag.Form = Nothing
Set CDrag.TextBox = Nothing
Set CDrag = Nothing

End Sub
HTH

Félix Lima
Microsoft Online Support Engineer

This posting is provided "AS IS" with no warranties, and confers no
rights.
Get Secure! - www.microsoft.com/security

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"WindAndWaves" <ac****@ngaru.com> wrote in message
news:3n******************@news.xtra.co.nz...
Hi everyone,

Has anyone got any experience with drop and drag in Access?

I would like to make a calendar style form where my users can drop and drag appointments....

I am using Access 2003 and I have access to .net and the like, but I would really like to keep it simple.

Thank you

Nicolaas
---
Please immediately let us know (by phone or return email) if (a) this email contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004


Nov 12 '05 #8

P: n/a
Access has nothing built-in to allow drag and drop between controls.
There are some third-party tools that might help:

A shareware version of Drag-N-Dropper for MS Access is available at
this web site: http://www.peterssoftware.com/dd.htm

Stephen Lebans has an example of a FieldList control that supports
drag and drop: http://www.lebans.com/vb_listbox.htm

The Forms Sample database provided by Microsoft has an example called
"Simulating Drag-And-Drop Capabilities". You can download the sample
database here: http://support.microsoft.com/default...b;EN-US;175066

Hope this helps,

--
Peter De Baets
Peter's Software - MS Access Tools for Developers
http://www.peterssoftware.com
Nov 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.