Link to home
Start Free TrialLog in
Avatar of johnberniejones
johnberniejones

asked on

Copy value from List Box using Double Click Event

I have an unbound list box with values that I would like to populate a memo field using a double click event. Any suggestions. The memo text box is bound to a table. I was hoping there would be a simple On_Double_Click event procedure that can copy the value to the memo field.
ASKER CERTIFIED SOLUTION
Avatar of Chris B
Chris B
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of johnberniejones
johnberniejones

ASKER

I've just realised I can select copy and paste using simple ctrl c and v keys... Thanks
You can, but double clicking the item in the list works fine, so why not...

Chris B
Assuming:

txtMemo  is your text box linked to memo filed
lstOptions is your list box to choose from.

On the dbl click event (of this list box) have:

  txtMemo  = Nz(txtMemo)  & ", " *  lstOptions

this will add your choise to the existing value of the list box seperated by a comma.

Mike
correction:

txtMemo  = Nz(txtMemo)  & ", " &  lstOptions

to avaid the comma in case there was no value int the memo field, use:

txtMemo  = iif(Nz(txtMemo,"")="", "",  ", ") &  lstOptions
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
How can you Copy and Paste from a List box ??

In the On Dbl Click event of the List box:

Me.YourMemoFieldTextBoxName = Me.YourListBoxName ...

mx
just as you have it:

Me.YourMemoFieldTextBoxName = Me.YourListBoxName

When you double click on the list box like

City:          
----------------
Los Angeles  |  
San Diego     |
.                    |
.                    |
.                    |
-----------------
   ^-- lstCity
When you double click on this list box, say on San Diego option, using:

Me!txtMemo = Me!lstCity

puts San diego into txtMemo box.

Mike
Here the code needs to be in the double click event of the list box (if wasn't made it clear).

Mike
Is there any additional concerns you may have?

Thanks,

Mike
DatabaseMX:,
<How can you Copy and Paste from a List box >
... just like you can with a combobox. It will copy the data in the Bound column.
(But I would still rather use automation)

Jeffc
Well I'll be .... $*(@&^!^!*(@^!

Funny ... never really needed to or tried to do that.  The little things we miss.  That's why we are all here.

Thank You Jeff ...

mx
LOL
<That's why we are all here>
I know...

Some wise expert here finally explained to me how to Re-index/optimize my queries.
;)

Jeffc
I think it was that rap artist...DMX!
;)
The little things I ... FORGET ... man, what a day!!
What thread was that ... seriously, I forgot.

mx
Aahh so.  Well, like I said, there is some conflicting info.  That post was the most recent info I've across.  However, I'm going to cross check all of that ... cuz I want to be sure it's 100% accurate. Like, that part about C&R re-optimizing stored queries ... don't recall hearing that per se in the past.

My partner and I did confirm some other stuff on indexes yesterday ... which is ... when you create a say ... a one to many (real) relationship (with ref integrity = yes) between two tables, Access automatically creates a hidden index on the field in the Many table. You won't see it in the properties for that field in table design view - it will say Indexed=No ... BUT ... if you enumerate tabledefs/indexes on that (Many) table, you WILL see it. AND ... if you go ahead and set Indexed=Yes for that field ... you will actually end up with two (duplicate) indexes!!  

This becomes important when you start to reach the 32 index limit in any one table ..ie, there may be hidden indexes you do see listed in the Index (lighting bolt) dialog ... which was the case with and mdb he inherited .. and was trying to create another relationship on that table ... and Access said: "Sooo sorree, 32 index limit exceeded!!!"


mx
johnberniejones,

Your original question:
<I have an unbound list box with values that I would like to populate a memo field using a double click event.>

burrcm, proposed solution:
< memo = Text1 >

Your reply:
<I've just realised I can select copy and paste using simple ctrl c and v keys... Thanks>

However your own "Solution" does satisfy the "Double-Click" criteria you set forth in the original question?

Jeff Coachman


Do we have a resolution to this question?  Just checking ...

mx
Forced accept.

Computer101
EE Admin