X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Drag And Drop Access - By Access Mvp Within Subform, Access 2016    
post Jul 12 2018, 04:57 AM

Posts: 53
Joined: 9-June 18

Hi UtterAccess

After numerous hours attempts, I reach out to someone who is confident to modify the existing MVP solution of Drag and Drop

The solution is in http://www.vb123.com.au/ for Doug Steele,
Drag and Drop in Access

I wish to have this initial version to
be embedded in a subframe and to work as per the original version.
Only for the 2 listboxes

I attach all 3 versions,
Steele_Drag_Drop (Original)
Steele_Drag_Drop - Testing (Pops up with Message box for the selected drag items
Steele_Drag_Drop - Testing Subforms (has the 2 text boxes in a subform)

I started off some VBA code changes
in the DragandDrop module
but the entire running needs to be checked.

Why, one may ask a subframe, and if it can be modified, then this is similar to our prototype of a mainframe / subframe.

Thank you kindly in advance.

Attached File  Steele_Drag_Drop___Testing_Subforms.zip ( 338.61K )Number of downloads: 13

Go to the top of the page
post Jul 12 2018, 06:40 AM

UA Admin
Posts: 34,544
Joined: 20-June 02
From: Newcastle, WA

You are asking for someone to make this modification for you? Do you plan to incorporate the result into a database application for your business? Is it something you might do for the learning involved?

What did you try yourself? You mentioned numerous hours of attempts. What did that entail?

Doug is a member here and may see this request. If so, he may consider it worthwhile to assist you.

Note that you use the term "mainframe / subframe" which I assume means that you want to use this method in a subform control in a main form. Correct?
Go to the top of the page
post Jul 12 2018, 07:45 AM

Posts: 53
Joined: 9-June 18

Thank you George

Absolutely I will share my final database as many utteraccesd fans and MVP helped me.

I have been doing this as a favour to my cousin who has a new business

I tried firstly embedding the list boxes in the subfform and then modifying someone VBA code when the form has set focus.

I am happy to do more grunt work if I can get some syntax to get it working.

My ultimate solution is to have a cross tab query in a subform that is interactive when double clicked to bring up a form
While at the same time to incorporate doug work

Thank you again

This post has been edited by AccessQuery: Jul 12 2018, 07:47 AM
Go to the top of the page
post Jul 12 2018, 10:30 AM

UA Admin
Posts: 34,544
Joined: 20-June 02
From: Newcastle, WA

My point was that this is a substantial investment in new functionality for a business application. People are always happy to offer suggestions and ideas. They tend not to have free hours to invest in building a function.

To make it easier to get something going one thing might be to upload the work so far with specific questions.
Go to the top of the page
post Jul 12 2018, 07:02 PM

Posts: 53
Joined: 9-June 18

Thank you kindly George for the guidance,

absolutely then if I can be assisted on the first debug, I will try and continue the debugging process.

Please note I have uploaded the three versions in my previous post by Doug Steele (first one original)

1) Steele_Drag_Drop (Original)
I am only using the frmListBoxExample to drag/drop between the 2 listboxes

Next I just added a message box to this one
2) Steele_Drag_Drop - Testing (Pops up with Message box for the selected drag items

If you look in the Module Sub ListBoxExample

I have added these 2 lines of code:
'This value is in the DragCtrl Item 2. Find Syntax to extract
CustomerNameValue = DLookup("[CompanyName]", "[Customers]", "[CustomerID] ='" & CustomerIDValue & "'")
MsgBox CustomerIDValue & " " & CustomerNameValue

So when you drag and drop between the 2 list boxes, the msgbox comes up for each itemindicating which records are selectd.

3) Steele_Drag_Drop - Testing Subforms
I made a copy of frmListBoxExample
and called it subfrmListBoxExample
I took out the exit and command button, and just left the 2 listboxes in this subform
I then commented out the code for the exit and command button

Next, I then embedded this subfrmListBoxExample into the frmListBoxExample

Next I started debugging when I tried dragging and dropping. Because I know we have to change all the instances where the subframe may be referred to, as it now exists in a main fram.
I found that it causes a debug here:

In the Sub module


'This line works fine , as if I say in the immediate window ? mfrmDragForm.name, it returns the name of the subframe
Set mfrmDragForm = SourceForm


' But further down when it gets to this statement it debugs.
I am not sure if this has to reference MainFrame.Subframe.SetFocus.

'Commented out as it would debug

Apologies previously for being vague in my request. If I can get assistance past this first debug,
I will then continue debugging to try and get the Steele_Drag_Drop - Testing Subforms working

Thank you again in advance.

Go to the top of the page
post Jul 16 2018, 08:39 PM

Posts: 53
Joined: 9-June 18

Hi UtterAccess,

Just as a quick interim update to my last line of syntax requested that was debugging,
ie. SetFocus to the Subform in this prototype,

There is a perfect example on here

'From UtterAccess pfUARefSubform

Dim Frm As Form
Dim lgX As Long
Dim lgy As Long

For lgX = 0 To Forms.Count - 1

Set Frm = Forms(lgX)
'Debug.Print "Main Form Name: " & Frm.Name
'Debug.Print "____________________________________________"

For lgy = 0 To Frm.Controls.Count - 1

If Frm.Controls(lgy).ControlType = acSubform Then
'Debug.Print " Subform Name:"; Frm.Controls(lgy).Name
End If


Thank you kindly for the example,
I added the line: Frm.Controls(lgy).SetFocus
And this at least gets to the next line of code.
At yet it is still not complete, so I will update once again when finished.

Thank you.
Go to the top of the page
post Jul 16 2018, 09:33 PM

Posts: 53
Joined: 9-June 18

Hi UtterAccess

A quick success note, please find the second change required below in the following module

Sub ProcessDrop(DragForm As Form, _

If TypeOf DragCtrl Is ListBox Then
' To handle the processing for the listboxes on frmListBoxExample, we
' call another routine, rather than try to embed too much in this routine
'If DragForm.Name = "frmListBoxExample" Then
If DragForm.Name = "subfrmListBoxExample" Then

Hence these 2 ammendments now allows the subform to be 1) SetFocus and 2)The DragForm.Name to be processed

Now for the bigger challenge, to have a calendar from UtterAccess to have this logic to be able to move Calendar entries between dates, just like outlook Calendar does.

Thank you kindly again.
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    18th February 2019 - 05:12 AM