text box default values

H

Haggr

how to set a bound (to my data enty table) text box default value to a value
from a query
 
K

Ken Snell \(MVP\)

Assuming that you want a specific value from one field in one record in that
query, use an expression that uses the DLookup function in the DefaultValue
property of the textbox:

=DLookup("NameOfField", "NameOfQuery")

See Help for more information about the DLookup function and its arguments.
 
H

Haggr

tried default value property, before update, after update still no result.
Even made the query only have one result. If I change the bound property it
works but will save the data to the table. I have been working at this for
months.
 
H

Haggr

meant to say will not save the data.
tried default value property, before update, after update still no result.
Even made the query only have one result. If I change the bound property it
works but will save the data to the table. I have been working at this for
months.
Assuming that you want a specific value from one field in one record in that
query, use an expression that uses the DLookup function in the DefaultValue
[quoted text clipped - 7 lines]
 
K

Ken Snell \(MVP\)

Default Value works only when you begin a new record. It does not do
anything for an existing record that is being viewed/edited.

Give us more details about what you're trying to do, and in what context --
form, table, etc.

--

Ken Snell
<MS ACCESS MVP>

Haggr said:
meant to say will not save the data.
tried default value property, before update, after update still no result.
Even made the query only have one result. If I change the bound property
it
works but will save the data to the table. I have been working at this for
months.
Assuming that you want a specific value from one field in one record in
that
query, use an expression that uses the DLookup function in the
DefaultValue
[quoted text clipped - 7 lines]
value
from a query
 
H

Haggr via AccessMonster.com

I have 4 text boxes for my people to enter info:

1: job number
2: Their Name (default value is a text box on form)
3: Date (default value =Date()
4. Amount

All 4 are bound to a table that stores the info

The "Amount" text box I would like to show a default value so the will not
have to type in the info.

That record is in a query [QryNewBillingShop].[Total]
Haggr said:
meant to say will not save the data.
tried default value property, before update, after update still no result.
Even made the query only have one result. If I change the bound property it
[quoted text clipped - 6 lines]
 
P

Perry

Have you read the previous msg?
When creating a new record, (i'm repeating previous msg here) the
=Dlookup("Total", "QryNewBillingShop") default value will be stored in the
table.
You could also set this property in yr table design which actually
(depending on the circumstances) is the best option.
If it concerns a one off value, you had better lock the field/textbox on yr
form.

Really, previous msg was/is *the* suited method; or would you like to do
something else with it?
If so, clearly indicate what you want.

For instance:
can the outcome of =Dlookup("Total", "QryNewBillingShop") change during
lifecycle of the record?
In other words, it's not a one off value.
In other words, once stored in the table, can this value change?

If so, you will need to update the value on Form_BeforeUpdate()

Krgrds,
Perry

Haggr via AccessMonster.com said:
I have 4 text boxes for my people to enter info:

1: job number
2: Their Name (default value is a text box on form)
3: Date (default value =Date()
4. Amount

All 4 are bound to a table that stores the info

The "Amount" text box I would like to show a default value so the will not
have to type in the info.

That record is in a query [QryNewBillingShop].[Total]
Haggr said:
meant to say will not save the data.
tried default value property, before update, after update still no
result.
Even made the query only have one result. If I change the bound property
it
[quoted text clipped - 6 lines]
value
from a query
 
H

Haggr via AccessMonster.com

I did try that =Dlookup("Total", "QryNewBillingShop" in the default value,
before update, after update in the property for "Amount" but I still get
"ERROR" in the "Amount" text box.

the value in the data entry table does not change for that record and the
value in "Total", "QryNewBillingShop" does not change.

I can't change the property setting because other forms will add data to
that field also that would be coming from a different field in
QryNewBillingShop

Thanks said:
Have you read the previous msg?
When creating a new record, (i'm repeating previous msg here) the
=Dlookup("Total", "QryNewBillingShop") default value will be stored in the
table.
You could also set this property in yr table design which actually
(depending on the circumstances) is the best option.
If it concerns a one off value, you had better lock the field/textbox on yr
form.

Really, previous msg was/is *the* suited method; or would you like to do
something else with it?
If so, clearly indicate what you want.

For instance:
can the outcome of =Dlookup("Total", "QryNewBillingShop") change during
lifecycle of the record?
In other words, it's not a one off value.
In other words, once stored in the table, can this value change?

If so, you will need to update the value on Form_BeforeUpdate()

Krgrds,
Perry
I have 4 text boxes for my people to enter info:
[quoted text clipped - 18 lines]
 
H

Haggr via AccessMonster.com

I got thanks guys
I did try that =Dlookup("Total", "QryNewBillingShop" in the default value,
before update, after update in the property for "Amount" but I still get
"ERROR" in the "Amount" text box.

the value in the data entry table does not change for that record and the
value in "Total", "QryNewBillingShop" does not change.

I can't change the property setting because other forms will add data to
that field also that would be coming from a different field in
QryNewBillingShop

Thanks
Have you read the previous msg?
When creating a new record, (i'm repeating previous msg here) the
[quoted text clipped - 25 lines]
 
Top