Assigning value to text box in a form

  • Thread starter brunogrd via AccessMonster.com
  • Start date
B

brunogrd via AccessMonster.com

Hello there,

I'm trying to assign a value to a text box.
I thought that would have been pretty easy but I keep getting an error 2448
"You can't assign a value to this object"

This is the simple code that I've been using to do so

Me.txtTotalAmount.Value = "123"

Any idea on what I could modify the codes to make it work?

Thanks,

Bruno.
 
G

Guest

The name of your control "txtTotalAmount" implies that it is a calculated
control, which might explain why you're having trouble assigning a value to
it. You might want to check to see what the control source is for this
control.

brunogrd via AccessMonster.com said:
Still having an error Nr 80020009
That doesn't seem to work either...

Bruno

Bob said:
How about Me.txtTotalAmount = "123"

Bob
Hello there,
[quoted text clipped - 12 lines]
 
B

brunogrd via AccessMonster.com

I'm actually calculating the total amount in a variable and would like to
display the value into the txtTotalAmount text box but can not succeed in
doing so. this is the exact code that I'm using

Me.txtTotalAmount = ShipValue

Thanks,

Bruno,
The name of your control "txtTotalAmount" implies that it is a calculated
control, which might explain why you're having trouble assigning a value to
it. You might want to check to see what the control source is for this
control.
Still having an error Nr 80020009
That doesn't seem to work either...
[quoted text clipped - 10 lines]
 
G

Guest

Your error message seems to indicate that there is something about
txtTotalAmount that prevents a value being assigned to it. Look at the
properties sheet for txtTotalAmount and see what is listed as it's control
source. It might have a calculation such as; =([somefield]*[someotherfield]),
or it might be bound directly to a field in the table, an that field is not
able to have a value assigned.

Also, is there a reason you are performing your calculation in code an then
trying to assign the result to txtTotalAmount, instead of placing the
calculation directly in the control? There are reasons why you might need to
do this, but if you post this info, it may help the responders in this group
to solve your problem.

brunogrd via AccessMonster.com said:
I'm actually calculating the total amount in a variable and would like to
display the value into the txtTotalAmount text box but can not succeed in
doing so. this is the exact code that I'm using

Me.txtTotalAmount = ShipValue

Thanks,

Bruno,
The name of your control "txtTotalAmount" implies that it is a calculated
control, which might explain why you're having trouble assigning a value to
it. You might want to check to see what the control source is for this
control.
Still having an error Nr 80020009
That doesn't seem to work either...
[quoted text clipped - 10 lines]
 
B

brunogrd via AccessMonster.com

Oups ...This is correct....
I've removed the expression into the property text box field which reverted
it to unbound and now it works as intented.

Thanks for the advise.

Bruno;


Bob said:
Is the text box bound to a query or table column?
Still having an error Nr 80020009
That doesn't seem to work either...
[quoted text clipped - 10 lines]
 
B

Bob Howard

Which means the query (probably not a table) was such that the field could
not be changed... Bob

brunogrd via AccessMonster.com said:
Oups ...This is correct....
I've removed the expression into the property text box field which
reverted
it to unbound and now it works as intented.

Thanks for the advise.

Bruno;


Bob said:
Is the text box bound to a query or table column?
Still having an error Nr 80020009
That doesn't seem to work either...
[quoted text clipped - 10 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top