Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cut & Paste from form to subform 2

Status
Not open for further replies.

jimbo08

Programmer
May 4, 2001
12
US
I have inherited a database that I recently converted from 97 to Access 2003. Several of the users have complained that they are unable to copy data from one field on a form, and paste the copied data to another field on a subform in that same form. When the user clicks 'paste", there is a few seconds of hourglass activity, but no paste. If the user tries again, Access strangly appends the copied data to the end of the string in the copied control. The users insist that they could make this paste when the app was Access 97. Any thoughts?
 
Ho are ya jimbo08 . . .

I can't explain the delay or need to double paste (may be a bug), however, how data is pasted from the clipboard depends on [blue]highlighting[/blue] or [blue]cursor position.[/blue]
[ol][li]If a single letter up to the full text of the destination is highlighted, the highlight will be replaced.[/li]
[li]Without highlighting, data is inserted at the cursor position.[/li][/ol]
I don't have 97 to check, but if what you say is true then [blue]selecting a control highlighted the entire text![/blue]

Also, give a look in [blue]Tools[/blue] - [blue]Options[/blue] - [blue]Keyboard Tab[/blue] - [blue]Behavior entering field section[/blue] for where the cursor will be set. Note: this applies to keyboard navigation . . . not the mouse.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
jimbo08 . . .

If your users won't mind double-clicking the textboxes to copy/paste, the following which can be expanded on, should do the trick:
[ol][li]In the declaration section of a module in the modules window, copy/paste the following line:
Code:
[blue]Public ClipBd[/blue]
[/li]
[blue]ClipBd[/blue] of course holds the copied data.
[li]In the same module copy/paste the following routine:
Code:
[blue]Public Sub CopyPaste(ctl As Control)
   ctl.SelLength = Len(ctl)
   
   If IsEmpty(ClipBd) Then
      ClipBd = ctl
   Else
      ctl = ClipBd
      ClipBd = Empty
   End If

End Sub[/blue]
[/li]
[li]Finally, in the [blue]DBl Click[/blue] event of the textboxes of interest, copy/paste the following:
Code:
[blue]   Call CopyPaste(Me![purple][b][i]TextboxName[/i][/b][/purple])[/blue]
[/li][/ol]
Thats it! . . . [blue]double-click to copy[/blue] . . . [blue]double-click to paste[/blue].

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Thanks, Ace Man!

Your idea is a good one. You have not given me a complete solution, but a path to it. My users typically copy a string that may be one or two highlighted words in the source control, and then paste them to the end of existing text in the destination control. But -- since the copied field and the "appended to" fields are always the same ones, I can modify your idea to (on dblclick) pop up a form with the complete source string data, allow the user to parse this copied data, and then (with the click of a button) have it appended to the data in the second control. Thanks!

I can't help but wonder what is really wrong here in that functionality apparently built into Windows/Office does not work in this situation, and we find ourselves coding around the problem. Is there some new property (or combination of properties) not a part of Access 97 that is automatically set in the conversion to 2003, and that ultimately causes this strange behavior? Perhaps someone out there knows?

Thanks again for your help.

Jimbo08
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top