By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

annoying problem editing default values on new records

P: n/a
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?

May 16 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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!Category = "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

May 17 '07 #2

P: n/a
<he**********@yahoo.com.auwrote in message
news:11**********************@w5g2000hsg.googlegro ups.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.SelStart = Len(Me.txtNote) +1
End Sub

Fred Zuckerman
May 17 '07 #3

P: n/a
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!Category = "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.

May 18 '07 #4

P: n/a
On May 18, 3:52 am, "Fred Zuckerman" <Zuckerm...@sbcglobal.netwrote:
<helenwhee...@yahoo.com.auwrote in message

news:11**********************@w5g2000hsg.googlegro ups.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.

May 18 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.