Drag and Drop

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • WindAndWaves

    #1

    Drag and Drop

    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


  • Larry  Linson

    #2
    Re: Drag and Drop

    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

    "WindAndWav es" <access@ngaru.c om> wrote in message
    news:3ndnc.2073 $XI4.90642@news .xtra.co.nz...[color=blue]
    > 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[/color]
    drag[color=blue]
    > 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[/color]
    email[color=blue]
    > 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
    >
    >[/color]


    Comment

    • WindAndWaves

      #3
      Re: Drag and Drop

      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" <bouncer@localh ost.not> wrote in message
      news:_Hgnc.9805 8$G_.83493@nwrd dc02.gnilink.ne t...[color=blue]
      > 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
      >
      > "WindAndWav es" <access@ngaru.c om> wrote in message
      > news:3ndnc.2073 $XI4.90642@news .xtra.co.nz...[color=green]
      > > 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[/color]
      > drag[color=green]
      > > appointments... .
      > >
      > > I am using Access 2003 and I have access to .net and the like, but I[/color][/color]
      would[color=blue][color=green]
      > > really like to keep it simple.
      > >
      > > Thank you
      > >
      > > Nicolaas
      > >
      > >
      > > ---
      > > Please immediately let us know (by phone or return email) if (a) this[/color]
      > email[color=green]
      > > 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
      > >
      > >[/color]
      >
      >[/color]


      ---
      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


      Comment

      • Siggy = Sigurd Bruteig

        #4
        Re: Drag and Drop

        Hi
        There is a sample at this link


        --
        _______________ _____________

        Sigurd Bruteig




        "WindAndWav es" <access@ngaru.c om> skrev i melding
        news:3ndnc.2073 $XI4.90642@news .xtra.co.nz...[color=blue]
        > 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[/color]
        drag[color=blue]
        > 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[/color]
        email[color=blue]
        > 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
        >
        >[/color]


        Comment

        • Tom van Stiphout

          #5
          Re: Drag and Drop

          On Sun, 9 May 2004 15:30:13 +1200, "WindAndWav es" <access@ngaru.c om>
          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.


          [color=blue]
          >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" <bouncer@localh ost.not> wrote in message
          >news:_Hgnc.980 58$G_.83493@nwr ddc02.gnilink.n et...[color=green]
          >> 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
          >>
          >> "WindAndWav es" <access@ngaru.c om> wrote in message
          >> news:3ndnc.2073 $XI4.90642@news .xtra.co.nz...[color=darkred]
          >> > 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[/color]
          >> drag[color=darkred]
          >> > appointments... .
          >> >
          >> > I am using Access 2003 and I have access to .net and the like, but I[/color][/color]
          >would[color=green][color=darkred]
          >> > really like to keep it simple.
          >> >
          >> > Thank you
          >> >
          >> > Nicolaas
          >> >
          >> >
          >> > ---
          >> > Please immediately let us know (by phone or return email) if (a) this[/color]
          >> email[color=darkred]
          >> > 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
          >> >
          >> >[/color]
          >>
          >>[/color]
          >
          >
          >---
          >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
          >[/color]

          Comment

          • WindAndWaves

            #6
            Re: Drag and Drop

            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


            Comment

            • Larry  Linson

              #7
              Re: Drag and Drop

              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


              "WindAndWav es" <access@ngaru.c om> wrote in message
              news:1WBnc.2723 $XI4.104562@new s.xtra.co.nz...[color=blue]
              > 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[/color]
              email[color=blue]
              > 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
              >
              >[/color]


              Comment

              • Stephen Lebans

                #8
                Re: Drag and Drop

                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 _
                "CallWindowProc A" (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.dl l" _
                (ByVal hWnd As Long, _
                ByVal fAccept As Long)

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

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

                Public Function WindowProc(ByVa l 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.AcceptDro ppedFiles 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 SubClassHookFor m()

                Call DragAcceptFiles (frm.hWnd, 1)

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

                Set CDrag = Me

                End Sub

                Public Sub SubClassUnHookF orm()

                Call SetWindowLong(f rm.hWnd, GWL_WNDPROC, lpPrevWndProc)

                Call DragAcceptFiles (frm.hWnd, 0)

                End Sub


                Sub AcceptDroppedFi les(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(h Drop, 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(h Drop, 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.SubClassH ookForm

                End Sub



                Private Sub Form_Unload(Can cel As Integer)
                'UnSubclass the form

                CDrag.SubClassU nHookForm
                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

                Access Code, Tips and Tricks
                Please respond only to the newsgroups so everyone can benefit.


                "WindAndWav es" <access@ngaru.c om> wrote in message
                news:3ndnc.2073 $XI4.90642@news .xtra.co.nz...[color=blue]
                > 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[/color]
                drag[color=blue]
                > appointments... .
                >
                > I am using Access 2003 and I have access to .net and the like, but I[/color]
                would[color=blue]
                > really like to keep it simple.
                >
                > Thank you
                >
                > Nicolaas
                >
                >
                > ---
                > Please immediately let us know (by phone or return email) if (a) this[/color]
                email[color=blue]
                > 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
                >
                >[/color]

                Comment

                • Peter De Baets

                  #9
                  Re: Drag and Drop

                  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

                  Comment

                  Working...