Results 1 to 7 of 7
  1. #1
    SpaceEd is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    17

    Access form field editing

    Hi,
    I have a form in Access with several fields. Users can go in and make changes, save the record, and exit. However, if there is already existing data in a field and a user goes to edit it, all the information in the field gets cleared and starts over. For example, if I have “A long string of data” already in a field, then I go and edit the field, the “A long string of data” disappears and is replaced with whatever I began typing.

    Is there a property of the Access form that I could change to stop this? It would be nice if it could function similarly to if you double click in a cell in excel.



    Any help would be greatly appreciated!!!

    Thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    No property that I know of.

    You could use code that positions cursor in the control, otherwise user has to manually click to position cursor.

    Example to set cursor position at the end of 'A long string of data':

    Private Sub cbxSample_Enter()
    If Not IsNull(Me.cbxSample) Then Me.cbxSample.SelStart = Len(Me.cbxSample)
    Me.cbxSample.Dropdown
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by SpaceEd View Post

    ...Is there a property of the Access form that I could change to stop this?
    My guess would be that your version of Access has its 'On Entering Field' Option set to 'Select Entire Field,' which does just that, and when you start typing the current data is overwritten. You can change this to 'Go to End of Field' and the cursor will do that when you Tab into the Textbox. This is installation specific, which is to say changing it will only change it on that computer! The Option would also have to be changed on any PCs that that will run the Database. Also, if the users use the mouse to click into the Field, this Option will not help!

    To do this through Code, so that it will 'follow the database,' i.e. it will apply to all PCs that are running the app, you'll need this, for each concerned Control:

    Code:
    Private Sub ControlName_Click()
     If Not IsNull(Me.ControlName) Then Me.ControlName.SelStart = Len(Me.ControlName)
    End Sub

    Code:
    Private Sub ControlName_Enter()
     If Not IsNull(Me.ControlName) Then Me.ControlName.SelStart = Len(Me.ControlName)
    End Sub


    This is essentially the same code that June7 gave, but placed in different events. He also apparently thought the question was about a Combobox, for some reason, hence the line about dropping it down.

    Linq ;0)>

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I just happened to pick on a combobox that has the code, most of my controls with SelStart are comboboxes.

    That app setting is under ClientSettings, never gave those much thought.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by June7 View Post

    ...most of my controls with SelStart are comboboxes.
    Just out of curiosity, why would you use SelStart with a Combobox?

    Linq ;0)>

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    These comboboxes are not limited to items in list. RowSource gives users suggestions from what is already in the form's RecordSource table, not a lookup table of values. They can select an item and make minor edits as necessary. AutoExpand aids selecting item but entry is free-form, input whatever they want.

    Then SelStart comes in handy for:

    1. During data entry user has option to initiate another record with same data from previous record but there might be minor edits to the data, such as changing 'Maximum SpG of HMA-OG-11' to 'Maximum SpG of HMA-OG-12'.

    2. Existing record might require edit and the value requires a minor change as described in 1.

    In each of the above, user doesn't have to position cursor at end of text when they enter field, just backspace and type away.

    Then there's the fact users asked for it and I aim to please users.
    Last edited by June7; 11-16-2012 at 06:30 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    SpaceEd is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    17
    Thanks for the help June7 and Linq. I'll be using that feature, possibly "On Double-click"

    Again, thank you!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access crashes when editing VBA
    By Tingholm in forum Programming
    Replies: 5
    Last Post: 01-16-2013, 01:29 AM
  2. Access Editing
    By Brian Gregg in forum Access
    Replies: 8
    Last Post: 06-11-2011, 04:21 AM
  3. access will not allow editing
    By wthoffman in forum Access
    Replies: 3
    Last Post: 12-18-2010, 02:13 PM
  4. Replies: 1
    Last Post: 03-13-2010, 12:32 PM
  5. Replies: 0
    Last Post: 03-26-2007, 12:24 AM

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