473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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?

May 16 '07 #1
4 3361
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
<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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ryan | last post by:
I have some software (written in Delphi 5) which has been working for several months without a problem. I have been given a copy of the database on our development server (SQL 7) and have...
3
by: Oren | last post by:
Hi, I have an Access application with linked tables via ODBC to MSSQL server 2000. Having a weird problem, probably something i've done while not being aware of (kinda newbie). the last 20...
3
by: Anthony Kroes | last post by:
I have a subform on a form and they are not linked. On the main form is a text box where the user types in a number. When that number changes, I have some code to make the corresponding text...
1
by: RC | last post by:
I have an Access 2002 database with many tables and forms (but just to keep things simple, let's say the DB has one Table "Table1" and one Form "Form1"). I have managed to cobble together so much...
2
by: jerome g | last post by:
Hi, I'm trying to use a (simple) form to create a new record, with all values being default values coming from a previous form. My problem is that I can save that new record only if I change one...
10
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
1
by: Tom Bianchi | last post by:
Hi, I am using VS2005. I have a form that I use both to insert new records and modify existing records. I want that if the user tries to close the form, the application asks the user to save...
0
by: Michael | last post by:
Hi I'm having a problem getting the newvalues or oldvalues from the RowUpdating event. I have the following code for the event(See note): Protected Sub grdPOs_RowUpdating(ByVal sender As Object,...
2
by: GeoffreyB | last post by:
Hello, These discussions have been a tremendous resource, and have really helped me make a lot of progress in a project that I'm working on. As for my problem... I've been working on a form...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.