[AccessD] Sel Start and Sel Length not working for me

Max Wanadoo max.wanadoo at gmail.com
Thu Apr 2 15:42:40 CDT 2009


Rocky,
Might be way off the beam, but
1. have a look at how you are "entering" the control
2. the have a look at what "options" you have selected, eg (1-start of text,
2= end of test, etc) = cant actually remember what the options are, but one
may be overriding the other, IOW your code may be running ok, and then you
may have a system option saying "go to end of text".

Worth a look anyway.

Max



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: 02 April 2009 21:33
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Sel Start and Sel Length not working for me

Dan:

The code doesn't error.  Just doesn't select the text. I put in some
MsgBoxes.  Everything checks out. Just doesn't select the text.

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Thursday, April 02, 2009 1:16 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Sel Start and Sel Length not working for me

Hi Rocky,

For spellchecking I do this, and it works every time.  

    txt.SelStart = 0
    txt.SelLength = Len(txt.Text)
    
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdSpelling
    DoCmd.SetWarnings True

You might be having an issue with ctl, because I don't think that every
control has a length.  Also, the + 1 on the length could be a problem too.

Which line does your code error out on?

Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Thursday, April 02, 2009 3:03 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Sel Start and Sel Length not working for me

 Charlotte:

I pasted in the SelectEntire module and called it with Call
SelectEntire(Me.fldFHxDetaiMotherResponse) but no cigar.  

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Thursday, April 02, 2009 12:37 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Sel Start and Sel Length not working for me

Public Sub SelectEntire(ctl As Control)
  On Error Resume Next
  ctl.SelStart = 0
  ctl.SelLength = Len(ctl.Text) + 1
  If Err <> 0 Then
    ctl.SelLength = Len(ctl.Value) + 1
  End If
End Sub


Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Thursday, April 02, 2009 12:03 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Sel Start and Sel Length not working for me

Dear List:

In the got focus event of a bound text box I want to have all the current
text selected.  The box can only have a 0 or 1.It is bound to a field of
data type number

The following code should (I think, but obviously not) select all the text
in the box but doesn't.  Can anyone see why?

 

    Me.fldFHxDetailMotherResponse.SelStart = 0
    Me.fldFHxDetailMotherResponse.SelLength =
len(Me.fldFHxDetailMotherResponse)

I also tried:

    Me.fldFHxDetailMotherResponse.SelStart = 0
    Me.fldFHxDetailMotherResponse.SelLength = 1


just to make things simple.  But no soap.

 
MTIA,
 

Rocky Smolin

Beach Access Software

858-259-4334

www.e-z-mrp.com <http://www.e-z-mrp.com/> 

www.bchacc.com <http://www.bchacc.com/> 

 

 





--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list