Solved

Access 2007 - VB code

Posted on 2014-12-27
7
110 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
[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
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

688 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