Solved

Access 2007 - VB code

Posted on 2014-12-27
7
102 Views
Last Modified: 2015-01-01
My OS is win 7 Prof 64 bit and I use office 2007.  In my Access 2007, I have the following code :
Private Sub cmdCopy_Click()
' This procedure runs when the Copy button is clicked.
On Error GoTo Err_cmdCopy_Click

    ' Set focus on the results.
    Me.txtResults.SetFocus
    
    ' Copy the results to the clipboard.
    DoCmd.RunCommand acCmdCopy

Exit_cmdCopy_Click:
    On Error Resume Next
    Exit Sub
    
Err_cmdCopy_Click:
    MsgBox Err.Number & " " & Err.Description, vbCritical, "cmdCopy_Click"
    Resume Exit_cmdCopy_Click
End Sub

Open in new window

but when the button is clicked, it does not seem to  highlight all the text, it flickers before the start of the first character as the highlighting is from right to left, and sometimes I wonder if all the text have been selected.  
Is there any sure thing to do in code, that will highlight all the text, without any reasonable doubt?.
0
Comment
Question by:jegajothy
  • 3
  • 2
7 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 40519639
try

Me.txtResults.SetFocus
Me.txtResults.SelStart=0
Me.txtResults.SelLength = Len(Me.txtResults.Text)

   ' Copy the results to the clipboard.
     DoCmd.RunCommand acCmdCopy
0
 

Author Comment

by:jegajothy
ID: 40520060
No objections from me.  Thank u.
0
 

Author Comment

by:jegajothy
ID: 40526662
I've requested that this question be deleted for the following reason:

It is been moved to a different category where it has been answered. thank u.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 40526663
would you mind posting the solution here?
0
 

Author Closing Comment

by:jegajothy
ID: 40527003
works.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now