"You can't assign a value to this object"

E

eddiec

this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same error.

HEEEEELP!

cheers

eddiec :)
 
S

Steve Huff

what is strControlName a string variable or a text box?? Normally a text
box would be prefixed with txt and a string variable with str.

Can you give more specific info as your variable names are confusing.

--Steve Huff
 
E

eddiec

thanks for the feedback...

still have the same error...

Is there a limit to the maximum number of controls I can have on a report?
Currently I have approx 250

Thanks

eddie

MacDermott said:
Try
Me.Controls(strControlName).Value=strControlValue


eddiec said:
this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same error.

HEEEEELP!

cheers

eddiec :)
 
E

eddiec

hi Steve,

strControlName is a string that holds the name of the control whose value I
want to update

cheers

eddie


Steve Huff said:
what is strControlName a string variable or a text box?? Normally a text
box would be prefixed with txt and a string variable with str.

Can you give more specific info as your variable names are confusing.

--Steve Huff


eddiec said:
this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same
error.

HEEEEELP!

cheers

eddiec :)
 
M

MacDermott

There is indeed a maximum number of controls on a form, but that shouldn't
affect this -
unless you're trying to create a new control.
You haven't given us the context in which this code is running.
If you're creating new controls, you must be in design view.
And of course in Design View you can't set the control's Value property.
Could that be what's happening?


- Turtle

eddiec said:
thanks for the feedback...

still have the same error...

Is there a limit to the maximum number of controls I can have on a report?
Currently I have approx 250

Thanks

eddie

MacDermott said:
Try
Me.Controls(strControlName).Value=strControlValue


eddiec said:
this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same error.

HEEEEELP!

cheers

eddiec :)
 
G

Guest

Yes there is a limit to the number of controls in a report/form. The limit
in A2K is 754. Check help "Microsoft Access specifications for your versino.
This includes formating controls(ie lines) as well as data controls. This
limit is a bit misleading as it also includes any controls you may have added
and deleted. In other words, a running total.

Rosco

eddiec said:
thanks for the feedback...

still have the same error...

Is there a limit to the maximum number of controls I can have on a report?
Currently I have approx 250

Thanks

eddie

MacDermott said:
Try
Me.Controls(strControlName).Value=strControlValue


eddiec said:
this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same error.

HEEEEELP!

cheers

eddiec :)
 
E

eddiec

if I create a new text box it gets the value TextBox665 so there are at
least 665 controls on the report


Rosco said:
Yes there is a limit to the number of controls in a report/form. The
limit
in A2K is 754. Check help "Microsoft Access specifications for your
versino.
This includes formating controls(ie lines) as well as data controls. This
limit is a bit misleading as it also includes any controls you may have
added
and deleted. In other words, a running total.

Rosco

eddiec said:
thanks for the feedback...

still have the same error...

Is there a limit to the maximum number of controls I can have on a
report?
Currently I have approx 250

Thanks

eddie

MacDermott said:
Try
Me.Controls(strControlName).Value=strControlValue


this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same
error.

HEEEEELP!

cheers

eddiec :)
 
E

eddiec

so this is probably the problem (there are also a large number of lines in
the report)

Version is Access 2002


Rosco said:
Yes there is a limit to the number of controls in a report/form. The
limit
in A2K is 754. Check help "Microsoft Access specifications for your
versino.
This includes formating controls(ie lines) as well as data controls. This
limit is a bit misleading as it also includes any controls you may have
added
and deleted. In other words, a running total.

Rosco

eddiec said:
thanks for the feedback...

still have the same error...

Is there a limit to the maximum number of controls I can have on a
report?
Currently I have approx 250

Thanks

eddie

MacDermott said:
Try
Me.Controls(strControlName).Value=strControlValue


this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same
error.

HEEEEELP!

cheers

eddiec :)
 
E

eddiec

hi Rosco,

I have tried creating a new report and have copied the control and the code
into the new report and I get the same error. However if I copy the control
and the code into a form it works fine

Any thoughts?

Cheers

Eddie


Rosco said:
Yes there is a limit to the number of controls in a report/form. The
limit
in A2K is 754. Check help "Microsoft Access specifications for your
versino.
This includes formating controls(ie lines) as well as data controls. This
limit is a bit misleading as it also includes any controls you may have
added
and deleted. In other words, a running total.

Rosco

eddiec said:
thanks for the feedback...

still have the same error...

Is there a limit to the maximum number of controls I can have on a
report?
Currently I have approx 250

Thanks

eddie

MacDermott said:
Try
Me.Controls(strControlName).Value=strControlValue


this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same
error.

HEEEEELP!

cheers

eddiec :)
 
E

eddiec

eureka!!!!!!!!!!!!!!!!!

I was setting the value of the control in a sub where the control did not
yet exist

Thanks for all who helped

eddiec :)


Rosco said:
Yes there is a limit to the number of controls in a report/form. The
limit
in A2K is 754. Check help "Microsoft Access specifications for your
versino.
This includes formating controls(ie lines) as well as data controls. This
limit is a bit misleading as it also includes any controls you may have
added
and deleted. In other words, a running total.

Rosco

eddiec said:
thanks for the feedback...

still have the same error...

Is there a limit to the maximum number of controls I can have on a
report?
Currently I have approx 250

Thanks

eddie

MacDermott said:
Try
Me.Controls(strControlName).Value=strControlValue


this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same
error.

HEEEEELP!

cheers

eddiec :)
 
E

eddiec

eureka!!!!!!!!!!!!!!!!!

I was setting the value of the control in a sub where the control did not
yet exist

Thanks for all who helped

eddiec :)


Rosco said:
Yes there is a limit to the number of controls in a report/form. The
limit
in A2K is 754. Check help "Microsoft Access specifications for your
versino.
This includes formating controls(ie lines) as well as data controls. This
limit is a bit misleading as it also includes any controls you may have
added
and deleted. In other words, a running total.

Rosco

eddiec said:
thanks for the feedback...

still have the same error...

Is there a limit to the maximum number of controls I can have on a
report?
Currently I have approx 250

Thanks

eddie

MacDermott said:
Try
Me.Controls(strControlName).Value=strControlValue


this is driving me nuts:

strControlName = "txtColumnAverageWeight" & intColumnNumber
strControlValue = CStr(rs![AverageWeight])
Me(strControlName).Value = strControlValue

Gives error: "You can't assign a value to this object"

The controls are not bound to a data source and are visible

I tried Me(strControlName).Value = "hello world" and it gave the same
error.

HEEEEELP!

cheers

eddiec :)
 

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