Coding from Check Box

G

glnbnz

I have continuous report. The form that controls the report has a check box
called [Resolved]. I want to code the report so that when [Resolved] is
checked a colored rectangle called [boxResolved] appears under the record,
highlighting it.
I have a problem coding the 'if' statement. This how I would like it to go.

If [Resolved] = (checked) then
[boxResolved].visible = True
End If

I just don't know to code for a checkbox wheither it is checked or unchecked.

Thank you
glnbnz
 
C

Carl Rapson

glnbnz said:
I have continuous report. The form that controls the report has a check
box
called [Resolved]. I want to code the report so that when [Resolved] is
checked a colored rectangle called [boxResolved] appears under the record,
highlighting it.
I have a problem coding the 'if' statement. This how I would like it to
go.

If [Resolved] = (checked) then
[boxResolved].visible = True
End If

I just don't know to code for a checkbox wheither it is checked or
unchecked.

Thank you
glnbnz

The checkbox control will be True if it is checked and False if it is not:

If [Resolved] = True then ...


Carl Rapson
 
G

glnbnz

Carl Rapson said:
glnbnz said:
I have continuous report. The form that controls the report has a check
box
called [Resolved]. I want to code the report so that when [Resolved] is
checked a colored rectangle called [boxResolved] appears under the record,
highlighting it.
I have a problem coding the 'if' statement. This how I would like it to
go.

If [Resolved] = (checked) then
[boxResolved].visible = True
End If

I just don't know to code for a checkbox wheither it is checked or
unchecked.

Thank you
glnbnz

The checkbox control will be True if it is checked and False if it is not:

If [Resolved] = True then ...


Carl Rapson

Carl
I tried that and I get a runtime error: 2427 "You entered an expression that
has no value" I have tried it with [], () and blank around Resolved. What
else could I be doing wrong?
Thanks again
Glenn
 
C

Carl Rapson

glnbnz said:
Carl Rapson said:
glnbnz said:
I have continuous report. The form that controls the report has a check
box
called [Resolved]. I want to code the report so that when [Resolved]
is
checked a colored rectangle called [boxResolved] appears under the
record,
highlighting it.
I have a problem coding the 'if' statement. This how I would like it
to
go.

If [Resolved] = (checked) then
[boxResolved].visible = True
End If

I just don't know to code for a checkbox wheither it is checked or
unchecked.

Thank you
glnbnz

The checkbox control will be True if it is checked and False if it is
not:

If [Resolved] = True then ...


Carl Rapson

Carl
I tried that and I get a runtime error: 2427 "You entered an expression
that
has no value" I have tried it with [], () and blank around Resolved.
What
else could I be doing wrong?
Thanks again
Glenn

Is Resolved the name of the field in the table? If so, what is the name of
the checkbox control that is bound to the field? Use that control name in
the statement

If chkCheckboxName = True Then ...

with no brackets or parentheses around the name. If the name of the checkbox
control (not the bound field) is actually "[Resolved]" (including the
brackets), you may want to try removing the brackets from the control name.


Carl Rapson
 
G

glnbnz

Carl Rapson said:
glnbnz said:
Carl Rapson said:
I have continuous report. The form that controls the report has a check
box
called [Resolved]. I want to code the report so that when [Resolved]
is
checked a colored rectangle called [boxResolved] appears under the
record,
highlighting it.
I have a problem coding the 'if' statement. This how I would like it
to
go.

If [Resolved] = (checked) then
[boxResolved].visible = True
End If

I just don't know to code for a checkbox wheither it is checked or
unchecked.

Thank you
glnbnz

The checkbox control will be True if it is checked and False if it is
not:

If [Resolved] = True then ...


Carl Rapson

Carl
I tried that and I get a runtime error: 2427 "You entered an expression
that
has no value" I have tried it with [], () and blank around Resolved.
What
else could I be doing wrong?
Thanks again
Glenn

Is Resolved the name of the field in the table? If so, what is the name of
the checkbox control that is bound to the field? Use that control name in
the statement

If chkCheckboxName = True Then ...

with no brackets or parentheses around the name. If the name of the checkbox
control (not the bound field) is actually "[Resolved]" (including the
brackets), you may want to try removing the brackets from the control name.


Carl Rapson


Carl
The field in the table is called Resolved. I have even tried to name of the
checkbox to chkResolved and it still comes up with the same error. I don't
know if this is a factor but this database is in 2000 file format.

Thanks
Glenn
 
D

Douglas J. Steele

glnbnz said:
Is Resolved the name of the field in the table? If so, what is the name
of
the checkbox control that is bound to the field? Use that control name in
the statement

If chkCheckboxName = True Then ...

with no brackets or parentheses around the name. If the name of the
checkbox
control (not the bound field) is actually "[Resolved]" (including the
brackets), you may want to try removing the brackets from the control
name.
The field in the table is called Resolved. I have even tried to name of
the
checkbox to chkResolved and it still comes up with the same error. I
don't
know if this is a factor but this database is in 2000 file format.

Try using the keyword Me:

If Me.chkCheckboxName = True Then
 
G

glnbnz

Douglas J. Steele said:
glnbnz said:
Is Resolved the name of the field in the table? If so, what is the name
of
the checkbox control that is bound to the field? Use that control name in
the statement

If chkCheckboxName = True Then ...

with no brackets or parentheses around the name. If the name of the
checkbox
control (not the bound field) is actually "[Resolved]" (including the
brackets), you may want to try removing the brackets from the control
name.
The field in the table is called Resolved. I have even tried to name of
the
checkbox to chkResolved and it still comes up with the same error. I
don't
know if this is a factor but this database is in 2000 file format.

Try using the keyword Me:

If Me.chkCheckboxName = True Then

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Doug,
I tried that and received the same result. Here is a copy of the code:

Private Sub Report_Open(Cancel As Integer)

If Me.chkResolved = True Then
[Reports]![frmPhProblems]![boxResolved].Visible = True
Else
[Reports]![frmPhProblems]![boxResolved].Visible = False
End If
End Sub

This returns Run-time error '2427': You entered an expression that has no
value.
Thanks again for looking into this problem of mine,
Glnbnz
 
D

Douglas J. Steele

glnbnz said:
Douglas J. Steele said:
glnbnz said:
Is Resolved the name of the field in the table? If so, what is the
name
of
the checkbox control that is bound to the field? Use that control name
in
the statement

If chkCheckboxName = True Then ...

with no brackets or parentheses around the name. If the name of the
checkbox
control (not the bound field) is actually "[Resolved]" (including the
brackets), you may want to try removing the brackets from the control
name.

The field in the table is called Resolved. I have even tried to name
of
the
checkbox to chkResolved and it still comes up with the same error. I
don't
know if this is a factor but this database is in 2000 file format.

Try using the keyword Me:

If Me.chkCheckboxName = True Then

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Doug,
I tried that and received the same result. Here is a copy of the code:

Private Sub Report_Open(Cancel As Integer)

If Me.chkResolved = True Then
[Reports]![frmPhProblems]![boxResolved].Visible = True
Else
[Reports]![frmPhProblems]![boxResolved].Visible = False
End If
End Sub

This returns Run-time error '2427': You entered an expression that has no
value.
Thanks again for looking into this problem of mine,
Glnbnz

I don't see anything in that code that should raise that specific error.

Are you sure that the error arises from that code? If so, what line of code
is actually raising the error?
 
G

glnbnz

Douglas J. Steele said:
glnbnz said:
Douglas J. Steele said:
Is Resolved the name of the field in the table? If so, what is the
name
of
the checkbox control that is bound to the field? Use that control name
in
the statement

If chkCheckboxName = True Then ...

with no brackets or parentheses around the name. If the name of the
checkbox
control (not the bound field) is actually "[Resolved]" (including the
brackets), you may want to try removing the brackets from the control
name.

The field in the table is called Resolved. I have even tried to name
of
the
checkbox to chkResolved and it still comes up with the same error. I
don't
know if this is a factor but this database is in 2000 file format.

Try using the keyword Me:

If Me.chkCheckboxName = True Then

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Doug,
I tried that and received the same result. Here is a copy of the code:

Private Sub Report_Open(Cancel As Integer)

If Me.chkResolved = True Then
[Reports]![frmPhProblems]![boxResolved].Visible = True
Else
[Reports]![frmPhProblems]![boxResolved].Visible = False
End If
End Sub

This returns Run-time error '2427': You entered an expression that has no
value.
Thanks again for looking into this problem of mine,
Glnbnz

I don't see anything in that code that should raise that specific error.

Are you sure that the error arises from that code? If so, what line of code
is actually raising the error?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)



When I press 'debug' it highlights 'If Me.chkResovled = True Then'
When I hover over 'True' I get a highlight box that states 'True = True' if
that helps
glnbnz
 
C

Carl Rapson

glnbnz said:
Douglas J. Steele said:
glnbnz said:
:


Is Resolved the name of the field in the table? If so, what is the
name
of
the checkbox control that is bound to the field? Use that control
name
in
the statement

If chkCheckboxName = True Then ...

with no brackets or parentheses around the name. If the name of the
checkbox
control (not the bound field) is actually "[Resolved]" (including
the
brackets), you may want to try removing the brackets from the
control
name.

The field in the table is called Resolved. I have even tried to
name
of
the
checkbox to chkResolved and it still comes up with the same error.
I
don't
know if this is a factor but this database is in 2000 file format.

Try using the keyword Me:

If Me.chkCheckboxName = True Then

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Doug,
I tried that and received the same result. Here is a copy of the code:

Private Sub Report_Open(Cancel As Integer)

If Me.chkResolved = True Then
[Reports]![frmPhProblems]![boxResolved].Visible = True
Else
[Reports]![frmPhProblems]![boxResolved].Visible = False
End If
End Sub

This returns Run-time error '2427': You entered an expression that has
no
value.
Thanks again for looking into this problem of mine,
Glnbnz

I don't see anything in that code that should raise that specific error.

Are you sure that the error arises from that code? If so, what line of
code
is actually raising the error?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)



When I press 'debug' it highlights 'If Me.chkResovled = True Then'
When I hover over 'True' I get a highlight box that states 'True = True'
if
that helps
glnbnz

Once again, are you certain the checkbox control's name is 'chkResolved'? If
so, try putting the code into the Format event of the report's Detail
section. It may be that Report_Open is too soon to access that value of that
field.

Carl Rapson
 
G

glnbnz

Carl Rapson said:
glnbnz said:
Douglas J. Steele said:
:


Is Resolved the name of the field in the table? If so, what is the
name
of
the checkbox control that is bound to the field? Use that control
name
in
the statement

If chkCheckboxName = True Then ...

with no brackets or parentheses around the name. If the name of the
checkbox
control (not the bound field) is actually "[Resolved]" (including
the
brackets), you may want to try removing the brackets from the
control
name.

The field in the table is called Resolved. I have even tried to
name
of
the
checkbox to chkResolved and it still comes up with the same error.
I
don't
know if this is a factor but this database is in 2000 file format.

Try using the keyword Me:

If Me.chkCheckboxName = True Then

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Doug,
I tried that and received the same result. Here is a copy of the code:

Private Sub Report_Open(Cancel As Integer)

If Me.chkResolved = True Then
[Reports]![frmPhProblems]![boxResolved].Visible = True
Else
[Reports]![frmPhProblems]![boxResolved].Visible = False
End If
End Sub

This returns Run-time error '2427': You entered an expression that has
no
value.
Thanks again for looking into this problem of mine,
Glnbnz

I don't see anything in that code that should raise that specific error.

Are you sure that the error arises from that code? If so, what line of
code
is actually raising the error?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)



When I press 'debug' it highlights 'If Me.chkResovled = True Then'
When I hover over 'True' I get a highlight box that states 'True = True'
if
that helps
glnbnz

Once again, are you certain the checkbox control's name is 'chkResolved'? If
so, try putting the code into the Format event of the report's Detail
section. It may be that Report_Open is too soon to access that value of that
field.

Carl Rapson


Thank you, Carl, that was it. It works just fine now.
glnbnz
 

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