[AccessD] Selecting Entire Field

Charlotte Foust cfoust at infostatsystems.com
Fri Apr 3 11:10:00 CDT 2009


Yeah, right!  Try that one on your grown children some time and see how
it goes over!  LOL

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Friday, April 03, 2009 9:03 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Selecting Entire Field

C'mon Charlotte!  After all AGE just stands for Additional Great
Experience!

Dan
:-)

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Friday, April 03, 2009 10:47 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Selecting Entire Field

Oh, dear, is my age showing??  You used to be able to create a template
object in forms and reports (I believe you named it "Normal") and then
set its properties like font, etc. the way you wanted all newly created
objects of that type formatted.  It didn't work for code, of course,
only for property settings.

Charlotte Foust

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Friday, April 03, 2009 8:36 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Selecting Entire Field

Template?

R 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Friday, April 03, 2009 8:24 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Selecting Entire Field

Have you tried adding it to your template form?

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Friday, April 03, 2009 8:18 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Selecting Entire Field

That would be icing on the cake.  It works for the one form I need now.


Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jack and Pat
Sent: Friday, April 03, 2009 8:53 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Selecting Entire Field

Rocky,
Are you saying that you want a solution to work for all forms?

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Friday, April 03, 2009 9:26 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Selecting Entire Field

Max:

That looks like a very 'robust' solution.  I ended up using Charlotte's
snip for the click event and Application.SetOptions to set the enter
behavior to select the whole field.  But that Application.SetOptions
does not carry from one form to another.  You have to issue it in each
form where you want that behavior.  Setting it through the menus worked
but only until you exited. 

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Friday, April 03, 2009 2:38 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Selecting Entire Field

Rocky,
Dont know if you solved this last night but if not the code below will
select the entire field whether tabbed in or clicked in, regardless of
hte global setting in Tools/Options.
Max
ps. Haven't got access to previous correspondece/postings so the title
may be out of sync.  Sorry.


' Test the ability to select the entire contents of a bound field
regardless of the setting in Tools/Options/Keyboard ' tests only a
Currencyfield,Datefield,Numberfield,Stringfield
' does not work for boolean fields
' for each field we need to call the sub for both the OnClick event AND
the GotFocus event ' Max Sherman Apr 2009 Option Compare Database Option
Explicit Private ActiveCtl As Control

Private Sub BooleanField_Click()
' do not call sSelLength for boolean
End Sub

Private Sub BooleanField_GotFocus()
' do not call sSelLength for boolean
End Sub

Private Sub CurrencyField_Click()
  Call sSelLength
End Sub

Private Sub CurrencyField_GotFocus()
  Call sSelLength
End Sub

Private Sub DateField_Click()
  Call sSelLength
End Sub

Private Sub DateField_GotFocus()
  Call sSelLength
End Sub

Private Sub NumberField_Click()
  Call sSelLength
End Sub

Private Sub NumberField_GotFocus()
  Call sSelLength
End Sub

Private Sub StringField_Click()
  Call sSelLength
End Sub

Private Sub StringField_GotFocus()
  Call sSelLength
End Sub
Private Sub sSelLength()
  On Error GoTo errhandler
  Set ActiveCtl = Application.Screen.ActiveControl
  Debug.Print Application.Screen.ActiveControl.Name
  With ActiveCtl
    .SetFocus
    .SelStart = 0
    .SelLength = Len(Nz(ActiveCtl, "")) + 1
  End With
exithere:
  Exit Sub
errhandler:
  Select Case Err.Number
  Case 2474  ' not active control
    Debug.Print Application.Screen.ActiveControl.Name
    MsgBox Application.Screen.ActiveControl.Name
  Case Else
    MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
  End Select
  Resume exithere
End Sub
--
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

--
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