Need help with If statement

  • Thread starter Thread starter Slez via AccessMonster.com
  • Start date Start date
S

Slez via AccessMonster.com

I added a text box, txtRetain, to a report. I also added the following code
to the report's Open event:

Private Sub Report_Open(Cancel As Integer)
If Forms!frmMainScreen!frmProjectSubFormTab!chkRetain = True Then
[txtRetain].Value = "This Proposal is for material only"
Else
[txtRetain].Value = "Nothing"
End If

I'm trying to post the text (Value) when the checkbox, chkRetain, is checked.
I only get the following error when I run the report:

Run-time error '2448';
You can't assign a value to this object.

What can I do to diplay specific text when chkRetain is checked?
Help is appreciated! Thanks!
 
It is currently unbound.
Make the field "unbound" with no controlsource.
I added a text box, txtRetain, to a report. I also added the following code
to the report's Open event:
[quoted text clipped - 14 lines]
What can I do to diplay specific text when chkRetain is checked?
Help is appreciated! Thanks!
 
Slez said:
I added a text box, txtRetain, to a report. I also added the following code
to the report's Open event:

Private Sub Report_Open(Cancel As Integer)
If Forms!frmMainScreen!frmProjectSubFormTab!chkRetain = True Then
[txtRetain].Value = "This Proposal is for material only"
Else
[txtRetain].Value = "Nothing"
End If

I'm trying to post the text (Value) when the checkbox, chkRetain, is checked.
I only get the following error when I run the report:

Run-time error '2448';
You can't assign a value to this object.

What can I do to diplay specific text when chkRetain is checked?


The Open event is too early to set control values. Move the
code to the Format event of the section that contains the
text box.
 
That works as intended!
Marshall - If I had half the knowledge that you do, I'd be dangerous!
Thanks so much for the help!!
Slez

Marshall said:
I added a text box, txtRetain, to a report. I also added the following code
to the report's Open event:
[quoted text clipped - 13 lines]
What can I do to diplay specific text when chkRetain is checked?

The Open event is too early to set control values. Move the
code to the Format event of the section that contains the
text box.
 
Back
Top