Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Not quite sure I follow. You can place the cursor at the end of all text in the field using something like this.

    If Not IsNull(Me.FieldName.Value) Then


    Me.FieldName.SelText = Me.FieldName
    End If

    You can place the position of the cursor in a predetermined position using code like this

    Code:
      If IsNull(Me.NameOfField.Value) Then
       Me.NameOfField.SelStart = 0
      End If
    
      If Not IsNull(Me.NameOfField.Value) Then
        If Len(Me.NameOfField.Value) < 32000 Then
          Me.NameOfField.SelStart = 2
        Else
          Me.NameOfField.SelStart = 0
       End If
      End If
    THe following will delete all text after the second character, leaving the cursor just after the second character.

    Code:
    If Not IsNull(Me.FieldName.Value) Then
    Me.FieldName.SelText = Left(Me.FieldName, 2)
    End If

  2. #17
    giggly is offline Novice
    Windows XP Access 2000
    Join Date
    Apr 2014
    Posts
    11
    Quote Originally Posted by ItsMe View Post
    Not quite sure I follow. You can place the cursor at the end of all text in the field using something like this.

    If Not IsNull(Me.FieldName.Value) Then
    Me.FieldName.SelText = Me.FieldName
    End If

    You can place the position of the cursor in a predetermined position using code like this

    Code:
      If IsNull(Me.NameOfField.Value) Then
       Me.NameOfField.SelStart = 0
      End If
    
      If Not IsNull(Me.NameOfField.Value) Then
        If Len(Me.NameOfField.Value) < 32000 Then
          Me.NameOfField.SelStart = 2
        Else
          Me.NameOfField.SelStart = 0
       End If
      End If
    THe following will delete all text after the second character, leaving the cursor just after the second character.

    Code:
    If Not IsNull(Me.FieldName.Value) Then
    Me.FieldName.SelText = Left(Me.FieldName, 2)
    End If
    Thankyou so much ItsMe I was looking at the "selstart" and did wonder if that what i was looking for but wasnt sure how to use it the way i wanted, many thanks again for your valued assistance

  3. #18
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Sure thing. You may want to add code that would evaluate the field before executing a SelStart. If the field has saved data that the user previously inputted, you probably do not want to use SelStart. Imagine a user tabbing out of a field they just updated and then tabbing back into the field. Having SelStart automatically execute On Enter could edit data that should not be edited. Something like the Len() function combined with InStr() function may help to first evaluate the field.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Input mask
    By scorpion99 in forum Access
    Replies: 4
    Last Post: 02-21-2014, 02:18 AM
  2. input mask
    By slimjen in forum Forms
    Replies: 7
    Last Post: 10-07-2013, 03:20 PM
  3. Input Mask
    By qbc in forum Access
    Replies: 2
    Last Post: 01-20-2012, 03:27 PM
  4. Input mask messed up my field data type
    By ghostmachine in forum Access
    Replies: 2
    Last Post: 11-11-2010, 05:32 PM
  5. Input mask
    By doobybug in forum Access
    Replies: 2
    Last Post: 06-17-2009, 09:40 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums