Solved

Access 2007 - VB code

Posted on 2014-12-27
7
107 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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 120

Expert Comment

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

Author Closing Comment

by:jegajothy
ID: 40527003
works.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Calculate workdays and consider holidays database from microsoft 2007 8 23
Run SQL Server Proc from Access 11 31
is Microsoft Access going to Die? 9 49
Switch 5 17
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

773 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