dbTalk Databases Forums  

Error in SelStart function

comp.databases.ms-access comp.databases.ms-access


Discuss Error in SelStart function in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AA Arens
 
Posts: n/a

Default Error in SelStart function - 07-29-2009 , 10:10 AM






I use these code in the afterupdate event of a combobox to let the
cursor jump to another field and also to avoid it default highlight
the contents in that field:

Me.Description.SetFocus
Me.Description.SelStart = Len(Me.Description)

Strange is that is sometimes work, but mostly I get:

Runtime Error
Invalid use of Null
[End] [Debug]

How to solve, basically, I want to have the cursor at the end of the
text should there be text, to avoid highlighting, as the SetFocus
command works fine.

Bart

Reply With Quote
  #2  
Old   
Rich P
 
Posts: n/a

Default Re: Error in SelStart function - 07-29-2009 , 11:13 AM






text1.selstart specifies which character in a text string you want to
start text highliting at. If you want to highlight the entire text
string in a textbox try

text1.sellength '--starts at beginning of text in textbox and selects
the length specified

text1.sellength = len(text1) '--selects entire text in textbox

Rich

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #3  
Old   
Marshall Barton
 
Posts: n/a

Default Re: Error in SelStart function - 07-29-2009 , 12:54 PM



AA Arens wrote:

Quote:
I use these code in the afterupdate event of a combobox to let the
cursor jump to another field and also to avoid it default highlight
the contents in that field:

Me.Description.SetFocus
Me.Description.SelStart = Len(Me.Description)

Strange is that is sometimes work, but mostly I get:

Runtime Error
Invalid use of Null
[End] [Debug]

How to solve, basically, I want to have the cursor at the end of the
text should there be text, to avoid highlighting, as the SetFocus
command works fine.

You can not set SelStart to Null (Len(Null) is Null), Try
using:
Me.Description.SelStart = Len(Me.Description.Text)

--
Marsh

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.