To: Marshall Burton / Duane Hookom

G

Guest

I am attempting to make controls and labels visible or not based on whether
there is data in the first control or not. If the controls value is <= 0 make
all related control's visible porperties = False, if it's greater than >0
make all related control's properties = True. Below is a sample of my
approach. However, if used in the report on open event I get this error: "You
entered an expression that has no value. The expression may refer to an
object that has no value, such as a form, a report or a label control."

Sample code follows:

If Me![txtGN] <= 0 Then
Me![lblGN].Visible = False
Me![txtGN].Visible = False
Me![txtGN1].Visible = False
End If

If Me![txtGVP] <= 0 Then
Me![lblGVP].Visible = False
Me![txtGVP].Visible = False
Me![txtGVP1].Visible = False
End If

Any idea why I'm getting this error message?

Thanks for you input, as always!
 
D

Duane Hookom

You should try move the code to the On Format event of the section
containing the controls.
 
G

Guest

Mr. Hookom:

I'v moved the code to the format section. However, it still does not work
when I run the report all controls that should be set to visible = False are
still visible = True. Am I missing something? I do have other controls in the
PageHeaer section that do go to visible = False when the condition for it are
met. The current other ones are not working since the lable control
(Me![lblGN]) is in the header section, then another (Me![txtGN]) is in the
detail section and the third control (Me![txtGN1]) control is in the Report
Footer section. Would I need to place the code for each one in the respective
format section?

Thanks,



Duane Hookom said:
You should try move the code to the On Format event of the section
containing the controls.

--
Duane Hookom
MS Access MVP
--

Jay said:
I am attempting to make controls and labels visible or not based on whether
there is data in the first control or not. If the controls value is <= 0
make
all related control's visible porperties = False, if it's greater than >0
make all related control's properties = True. Below is a sample of my
approach. However, if used in the report on open event I get this error:
"You
entered an expression that has no value. The expression may refer to an
object that has no value, such as a form, a report or a label control."

Sample code follows:

If Me![txtGN] <= 0 Then
Me![lblGN].Visible = False
Me![txtGN].Visible = False
Me![txtGN1].Visible = False
End If

If Me![txtGVP] <= 0 Then
Me![lblGVP].Visible = False
Me![txtGVP].Visible = False
Me![txtGVP1].Visible = False
End If

Any idea why I'm getting this error message?

Thanks for you input, as always!
 
D

Duane Hookom

I would place code for a control in the On Format of the section containing
that control. If your controls are in multiple sections, you may need to
break your code into multiple sections.

--
Duane Hookom
MS Access MVP
--

Jay said:
Mr. Hookom:

I'v moved the code to the format section. However, it still does not work
when I run the report all controls that should be set to visible = False
are
still visible = True. Am I missing something? I do have other controls in
the
PageHeaer section that do go to visible = False when the condition for it
are
met. The current other ones are not working since the lable control
(Me![lblGN]) is in the header section, then another (Me![txtGN]) is in the
detail section and the third control (Me![txtGN1]) control is in the
Report
Footer section. Would I need to place the code for each one in the
respective
format section?

Thanks,



Duane Hookom said:
You should try move the code to the On Format event of the section
containing the controls.

--
Duane Hookom
MS Access MVP
--

Jay said:
I am attempting to make controls and labels visible or not based on
whether
there is data in the first control or not. If the controls value is <=
0
make
all related control's visible porperties = False, if it's greater than
0
make all related control's properties = True. Below is a sample of my
approach. However, if used in the report on open event I get this
error:
"You
entered an expression that has no value. The expression may refer to an
object that has no value, such as a form, a report or a label control."

Sample code follows:

If Me![txtGN] <= 0 Then
Me![lblGN].Visible = False
Me![txtGN].Visible = False
Me![txtGN1].Visible = False
End If

If Me![txtGVP] <= 0 Then
Me![lblGVP].Visible = False
Me![txtGVP].Visible = False
Me![txtGVP1].Visible = False
End If

Any idea why I'm getting this error message?

Thanks for you input, as always!
 
G

Guest

Duane:

I've placed this code in the PageHEader section of the report and the Lable
control is still visible when it should not be. Here is the code in this
section:

If Me![txtGN] <= 0 Then
Me![lblGN].Visible = False
'Me![txtGN].Visible = False
'Me![txtGN1].Visible = False
End If

If Me![txtGVP] <= 0 Then
Me![lblGVP].Visible = False
'Me![txtGVP].Visible = False
'Me![txtGVP1].Visible = False
End If

I must be missing something, what could it be?


Thanks again,.....
Duane Hookom said:
I would place code for a control in the On Format of the section containing
that control. If your controls are in multiple sections, you may need to
break your code into multiple sections.

--
Duane Hookom
MS Access MVP
--

Jay said:
Mr. Hookom:

I'v moved the code to the format section. However, it still does not work
when I run the report all controls that should be set to visible = False
are
still visible = True. Am I missing something? I do have other controls in
the
PageHeaer section that do go to visible = False when the condition for it
are
met. The current other ones are not working since the lable control
(Me![lblGN]) is in the header section, then another (Me![txtGN]) is in the
detail section and the third control (Me![txtGN1]) control is in the
Report
Footer section. Would I need to place the code for each one in the
respective
format section?

Thanks,



Duane Hookom said:
You should try move the code to the On Format event of the section
containing the controls.

--
Duane Hookom
MS Access MVP
--

I am attempting to make controls and labels visible or not based on
whether
there is data in the first control or not. If the controls value is <=
0
make
all related control's visible porperties = False, if it's greater than
0
make all related control's properties = True. Below is a sample of my
approach. However, if used in the report on open event I get this
error:
"You
entered an expression that has no value. The expression may refer to an
object that has no value, such as a form, a report or a label control."

Sample code follows:

If Me![txtGN] <= 0 Then
Me![lblGN].Visible = False
Me![txtGN].Visible = False
Me![txtGN1].Visible = False
End If

If Me![txtGVP] <= 0 Then
Me![lblGVP].Visible = False
Me![txtGVP].Visible = False
Me![txtGVP1].Visible = False
End If

Any idea why I'm getting this error message?

Thanks for you input, as always!
 
D

Duane Hookom

Have you tried setting a break point to step through the code? Is txtGH also
in the PageHeader? If not, try place a control in the PageHeader with the
value and use it in place of txtGN.

--
Duane Hookom
MS Access MVP


Jay said:
Duane:

I've placed this code in the PageHEader section of the report and the Lable
control is still visible when it should not be. Here is the code in this
section:

If Me![txtGN] <= 0 Then
Me![lblGN].Visible = False
'Me![txtGN].Visible = False
'Me![txtGN1].Visible = False
End If

If Me![txtGVP] <= 0 Then
Me![lblGVP].Visible = False
'Me![txtGVP].Visible = False
'Me![txtGVP1].Visible = False
End If

I must be missing something, what could it be?


Thanks again,.....
Duane Hookom said:
I would place code for a control in the On Format of the section containing
that control. If your controls are in multiple sections, you may need to
break your code into multiple sections.

--
Duane Hookom
MS Access MVP
--

Jay said:
Mr. Hookom:

I'v moved the code to the format section. However, it still does not work
when I run the report all controls that should be set to visible = False
are
still visible = True. Am I missing something? I do have other controls in
the
PageHeaer section that do go to visible = False when the condition for it
are
met. The current other ones are not working since the lable control
(Me![lblGN]) is in the header section, then another (Me![txtGN]) is in the
detail section and the third control (Me![txtGN1]) control is in the
Report
Footer section. Would I need to place the code for each one in the
respective
format section?

Thanks,



:

You should try move the code to the On Format event of the section
containing the controls.

--
Duane Hookom
MS Access MVP
--

I am attempting to make controls and labels visible or not based on
whether
there is data in the first control or not. If the controls value is <=
0
make
all related control's visible porperties = False, if it's greater than
0
make all related control's properties = True. Below is a sample of my
approach. However, if used in the report on open event I get this
error:
"You
entered an expression that has no value. The expression may refer to an
object that has no value, such as a form, a report or a label control."

Sample code follows:

If Me![txtGN] <= 0 Then
Me![lblGN].Visible = False
Me![txtGN].Visible = False
Me![txtGN1].Visible = False
End If

If Me![txtGVP] <= 0 Then
Me![lblGVP].Visible = False
Me![txtGVP].Visible = False
Me![txtGVP1].Visible = False
End If

Any idea why I'm getting this error message?

Thanks for you input, as always!
 

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