annoying problem editing default values on new records

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • helenwheelss@yahoo.com.au

    annoying problem editing default values on new records

    Access 2003, using a bound form.

    I'm seeing rather annoying behaviour when editing data in a control
    with a default value. It only happens when the form is on a new
    record.

    A specific example: on my form, the first control is bound to a date/
    time field and has a default value of now(). When users need to change
    this control's data, they'll most commonly need to alter the time part
    leaving the date as is. But, on a new record, when the user highlights
    the time part and presses delete, Access deletes the entire date and
    time, not just the characters the user highlighted.

    This behaviour isn't limited to date/time fields. If I set a default
    value of, say, "blah-1" in a text field's control, then go to edit a
    new record and attempt to change the control's contents from the
    default "blah-1" to "blah-2" by backspacing over the 1, the entire
    field is deleted, not just the character I intended to backspace over
    (and yes I do make sure the entire field is not selected before
    backspacing).

    This only happens on a new record, and only when the user hasn't
    entered any other data before attempting to alter the fields with a
    default value set.

    One possible workaround is to force the user to enter some other data
    before editing the fields with default values, but that seems a bit
    clunky, and on my particular form it's a lot more intuitive for the
    user to enter the now() date/time field first.

    Anyone else seen this weird editing behaviour with default values on
    new records? Any good workarounds?

  • Max Vit

    #2
    Re: annoying problem editing default values on new records

    Instead of defining default values you could do the trick by defining
    the desired value in VBA.

    Say you want field "Category" on form "Client" to be 'Platinum' on any
    new record.
    You could define in the appropriate event for the form (i.e. On Load -
    but need to ensure you point to a new record) something like:
    Forms!Client!Ca tegory = "Platinum"
    When the form is opened; you can highlight the 'm' and delete it so
    you end up with 'Platinu'.
    This would give you some idea on how to get around your issue.
    HTH

    Comment

    • Fred Zuckerman

      #3
      Re: annoying problem editing default values on new records

      <helenwheelss@y ahoo.com.auwrot e in message
      news:1179294969 .336303.249160@ w5g2000hsg.goog legroups.com...
      Access 2003, using a bound form.
      >
      I'm seeing rather annoying behaviour when editing data in a control
      with a default value. It only happens when the form is on a new
      record.
      >
      A specific example: on my form, the first control is bound to a date/
      time field and has a default value of now(). When users need to change
      this control's data, they'll most commonly need to alter the time part
      leaving the date as is. But, on a new record, when the user highlights
      the time part and presses delete, Access deletes the entire date and
      time, not just the characters the user highlighted.
      >
      This behaviour isn't limited to date/time fields. If I set a default
      value of, say, "blah-1" in a text field's control, then go to edit a
      new record and attempt to change the control's contents from the
      default "blah-1" to "blah-2" by backspacing over the 1, the entire
      field is deleted, not just the character I intended to backspace over
      (and yes I do make sure the entire field is not selected before
      backspacing).
      >
      This only happens on a new record, and only when the user hasn't
      entered any other data before attempting to alter the fields with a
      default value set.
      >
      One possible workaround is to force the user to enter some other data
      before editing the fields with default values, but that seems a bit
      clunky, and on my particular form it's a lot more intuitive for the
      user to enter the now() date/time field first.
      >
      Anyone else seen this weird editing behaviour with default values on
      new records? Any good workarounds?
      >
      Helen,
      It sounds like the user attempts to move to the end of the default value,
      but in reality, the entire value is still hightlighted. I have used the
      "SelStart" property with the "OnEnter" event to move the cursor to the end
      of the current value of the field.

      ***Caution - AirCode***
      Private Sub txtNote_Enter()
      Me.txtNote.SelS tart = Len(Me.txtNote) +1
      End Sub

      Fred Zuckerman


      Comment

      • helenwheelss@yahoo.com.au

        #4
        Re: annoying problem editing default values on new records

        On May 18, 12:08 am, Max Vit <m...@safe-mail.netwrote:
        Instead of defining default values you could do the trick by defining
        the desired value in VBA.
        >
        Say you want field "Category" on form "Client" to be 'Platinum' on any
        new record.
        You could define in the appropriate event for the form (i.e. On Load -
        but need to ensure you point to a new record) something like:
        Forms!Client!Ca tegory = "Platinum"
        When the form is opened; you can highlight the 'm' and delete it so
        you end up with 'Platinu'.
        This would give you some idea on how to get around your issue.
        HTH
        Interestingly, if I place data in ANY field in the new record using
        VBA (eg in the form's Current event), the user can then select and
        edit any part of the field with the default value. This is the
        workaround I'm using at the moment. It does still break down when an
        undo happens though, because that value set in VBA is also undone.

        Comment

        • helenwheelss@yahoo.com.au

          #5
          Re: annoying problem editing default values on new records

          On May 18, 3:52 am, "Fred Zuckerman" <Zuckerm...@sbc global.netwrote :
          <helenwhee...@y ahoo.com.auwrot e in message
          >
          news:1179294969 .336303.249160@ w5g2000hsg.goog legroups.com...
          >
          >
          >
          >
          >
          Access 2003, using a bound form.
          >
          I'm seeing rather annoying behaviour when editing data in a control
          with a default value. It only happens when the form is on a new
          record.
          >
          A specific example: on my form, the first control is bound to a date/
          time field and has a default value of now(). When users need to change
          this control's data, they'll most commonly need to alter the time part
          leaving the date as is. But, on a new record, when the user highlights
          the time part and presses delete, Access deletes the entire date and
          time, not just the characters the user highlighted.
          >
          This behaviour isn't limited to date/time fields. If I set a default
          value of, say, "blah-1" in a text field's control, then go to edit a
          new record and attempt to change the control's contents from the
          default "blah-1" to "blah-2" by backspacing over the 1, the entire
          field is deleted, not just the character I intended to backspace over
          (and yes I do make sure the entire field is not selected before
          backspacing).
          >
          This only happens on a new record, and only when the user hasn't
          entered any other data before attempting to alter the fields with a
          default value set.
          >
          One possible workaround is to force the user to enter some other data
          before editing the fields with default values, but that seems a bit
          clunky, and on my particular form it's a lot more intuitive for the
          user to enter the now() date/time field first.
          >
          Anyone else seen this weird editing behaviour with default values on
          new records? Any good workarounds?
          >
          Helen,
          It sounds like the user attempts to move to the end of the default value,
          but in reality, the entire value is still hightlighted. I have used the
          "SelStart" property with the "OnEnter" event to move the cursor to the end
          of the current value of the field.
          >
          Nope, that's definitely not the problem. Only the selected characters
          are highlighted, but when you hit the delete key, Access deletes the
          control's entire contents. Thanks for replying though.

          Comment

          Working...