Need help with If statement

  • Thread starter Slez via AccessMonster.com
  • 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!
 
S

Slez via AccessMonster.com

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!
 
M

Marshall Barton

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.
 
S

Slez via AccessMonster.com

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.
 

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