Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error 2115 when setting focus to textbox; Select all text in control

Posted on 2004-04-22
3
Medium Priority
?
339 Views
Last Modified: 2012-06-21

I am trying to set focus to a control after it has been populated by recordset...the following does not work. I want to also have all text selected --
control a does not seem to work in access

Set rst1 = InventoryDb.OpenRecordset(strRS)
If rst1.RecordCount > 0 Then
If rst1("Comments") <> "" And Not IsNull(rst1("Comments")) Then
[txtProComments] = "LAST COMMENT:" & rst1("Comments")
rst1.Close
Me.Refresh
[txtProComments].SetFocus
SendKeys ("_")
0
Comment
Question by:pdidow
[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
  • 2
3 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 500 total points
ID: 10892271
Try:
me.[txtProComments].SetFocus

Nic;o)
0
 

Author Comment

by:pdidow
ID: 10892828
No good. get the error message:

run-time error '2108'
you must save the field before you can execute the GoToControl action,
the GoToControl method, or the SetFocus Method...
0
 
LVL 54

Expert Comment

by:nico5038
ID: 10893174
I'm missing some endif statements, but try:

Set rst1 = InventoryDb.OpenRecordset(strRS)
If rst1.RecordCount > 0 Then
  If rst1("Comments") <> "" And Not IsNull(rst1("Comments")) Then
   me.txtProComments = "LAST COMMENT:" & rst1("Comments")
 endif
endif
rst1.Close
Me.Refresh
me.txtProComments.SetFocus
SendKeys ("_")

Nic;o)
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

610 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