Default Value in Query

  • Thread starter Thread starter jwr
  • Start date Start date
J

jwr

I have a table with two fields in which I have entered default values in the
default field at the bottom of the table-
"N" and the second field "C".

When I run a query, that information is not automatically inserted into the
query. What should I look for that I might be doing wrong?

Thanks
 
jwr said:
I have a table with two fields in which I have entered default values in the
default field at the bottom of the table-
"N" and the second field "C".

When I run a query, that information is not automatically inserted into the
query. What should I look for that I might be doing wrong?


A table field's DafaultValue is only used when a new record
is created and the field's value is not specified.

Generally, you should leave the existing value (Null or
otherwise) alone in a query. If you have changed the
field's DafaultValue property after the records were
created, then you should either leave it as is or use an
UPDATE query to set the value to what it would have been if
you had remembered to set the DefaultValue before adding the
records.
 
This query is being used by many people. I was attempting to have this info
"pull forward" from the table since it is the answer that the user will
input 99.9% of the time, but still allow them to enter something different
if need be.

I may have entered this after the query was built -- so I deleted the fields
from my query, saved, and re-entered the fields. They still do not pull
forward when the query is run. Perhaps I should be using a form.

Marshall -- you were so kind as to assist me on a previous post -- Combo Box
error. I wonder if you have time (and the patience) to reply to my last
post regarding the Drop Down List Box Problem dated 3-18-06. I am still not
getting the combo box to work.

Thank you
 
As I said before, the DefaultValue is only used when a new
record is created. It will be displayed in the table's
sheet view, a query's datasheet or a form's control bound to
the field, but only for the new record. You can specify a
DefaultValue for the table's field or in a form control
bound to the field.

This is a very straightforward thing to do, and the only
issue I have seen is when people expect a default value to
be used on existing records. Since you seem to be having so
much trouble with this, I expect that either you have
misunderstood how it works or that you have some other
explained things going on that are getting in the way.

For many reasons, you should only allow users to
view/enter/edit data through a form bound to the
table/query. Letting users manipulate data in a table's
sheet view or a query's datasheet can lead to problems
because you do not have much control over validations
whereas a form can use VBA procedures to perform all kinds
of data checking.

I don't see a post from you on 3/18. Maybe you posted it to
a group that I do not suscribe to?
 
Thank you -- I was trying to use it instead of the form. The form works
properly.

I had you confused with another Mr. B. However, the post is under forms --
Error in Combo Box.

Thank you,
Joy
Marshall Barton said:
As I said before, the DefaultValue is only used when a new
record is created. It will be displayed in the table's
sheet view, a query's datasheet or a form's control bound to
the field, but only for the new record. You can specify a
DefaultValue for the table's field or in a form control
bound to the field.

This is a very straightforward thing to do, and the only
issue I have seen is when people expect a default value to
be used on existing records. Since you seem to be having so
much trouble with this, I expect that either you have
misunderstood how it works or that you have some other
explained things going on that are getting in the way.

For many reasons, you should only allow users to
view/enter/edit data through a form bound to the
table/query. Letting users manipulate data in a table's
sheet view or a query's datasheet can lead to problems
because you do not have much control over validations
whereas a form can use VBA procedures to perform all kinds
of data checking.

I don't see a post from you on 3/18. Maybe you posted it to
a group that I do not suscribe to?
--
Marsh
MVP [MS Access]

This query is being used by many people. I was attempting to have this info
"pull forward" from the table since it is the answer that the user will
input 99.9% of the time, but still allow them to enter something different
if need be.

I may have entered this after the query was built -- so I deleted the fields
from my query, saved, and re-entered the fields. They still do not pull
forward when the query is run. Perhaps I should be using a form.

Marshall -- you were so kind as to assist me on a previous post -- Combo Box
error. I wonder if you have time (and the patience) to reply to my last
post regarding the Drop Down List Box Problem dated 3-18-06. I am still not
getting the combo box to work.

in
the into
the
 
If it works in a form, let's say we forget about whatever
was causing trouble in your query. Queries are great for
collecting data from tables, but their datasheet view is a
very poor mechanism dor presenting and interacting with
data.
 
Back
Top