[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Using the double click event to copy and paste

Posted on 2015-01-21
8
Medium Priority
?
293 Views
Last Modified: 2015-01-22
My question is about using the double click event in with a list box.

I want the user to be able to double click on the item in a listbox and have the text from that item copied and then pasted into a text box.

It seems like this should be really simple, but I am having a hard time working out how to code it.

Would it just be a matter of something like: on double click, with item selected, copy string in column 2, then paste that text into txtbox 1?

Also, the listbox is multisimple select. Will that be a problem? I am trying to avoid changing that.

Just looking for a little guidance to get this going.


Thank you!!!!!!
0
Comment
Question by:Megin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 75
ID: 40563350
Just curious ... why not single click?
Double clicking on a List Box is a bit unusual ...
And with MultiSelect Simple ... if user changes mind ... just click again (off) and remove text from text box.

mx
0
 
LVL 75
ID: 40563352
Also ... if you have any code in the Click event (?) ... that it's going to be very difficult to detect Double Click.

mx
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 40563383
private sub list1_DblClick(Cancel As Integer)

me.textbox1=me.list1.column(1)

end sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Megin
ID: 40563387
Right now the list box is populated with a list of records that the user has entered in past reports. The form that the list box is on is for the user to create reports. If the user wants to use a record from an old report in his/her new report, they select it from the list box, click a button, and it is added to the new report. If they want to add many old records to their new report, they just select multiple items before they click the button. It makes it quick and easy if their report rarely changes.

I just want to clone the record so that changes can be made to it in order to make a new record without changing the old one.

Ideally, double clicking on the item would just copy the text to a text box so that the record can be altered. For example, if the record is something long and wordy, has the name of the month in it, and has to be reported every month, I want the user to be able to double click on the record to copy and paste the text into a box, and then change the name of the month.      "Blah blah blah blah blah Janauary blah blah blah blah" becomes "Blah blah blah blah blah February blah blah blah blah"

The reason for the double click was to differentiate it from just selecting items. I thought about using the select option to do this, but then I can't use the multiselect simple setting (I only want the user to edit one item at a time).


If you have any better ideas for doing that, I am all ears.

Thank you!!!!
0
 
LVL 75
ID: 40563406
So, what happens when you do Double Click ?

Seems I recall an issue detecting DC with a multi select list box ... not sure.

mx
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40563409
<No Points wanted>

double click on the item in a listbox and have the text from that item copied and then pasted into a text box.
Also, the listbox is multisimple select
So if the user selects more than one item, you are forcing them to double-click each one?

Typically the user will select all the needed values, ...Then you would use code to gather all of the selected items, then do anything you want with them. (Display them horizontally, Vertically, Or put them all or individually in textboxes.
For example; by clicking a "Add values to textbox" button...
Code to collect all the selected could be something roughly like this:
Dim frm As Form, 
Dim ctl As Control
Dim varItem As Variant
Dim strSelItems As String
Set frm = Form!YourForm
    Set ctl = frm!YourMultiSelectListbox
    For Each varItem In ctl.ItemsSelected
        strSQL = strSQL & ctl.ItemData(varItem) & ", "
    Next varItem

Open in new window

...modified from:
http://access.mvps.org/access/forms/frm0007.htm

Perhaps I am missing something here though,
...I am sure Joe can get you sorted.
;-)

JeffCoachman
0
 

Author Closing Comment

by:Megin
ID: 40564711
That worked perfectly! Thank you!!!

(And thanks to everyone else!!)
0
 
LVL 75
ID: 40564721
I thought you were having an issue detecting Double Click.
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question