move control

geno

Registered User.
Local time
Today, 10:38
Joined
Jun 19, 2000
Messages
243
Hi,
I have some code in a report that if a field's value is null then I hide some controls. I have a line on this report that I need to move up higher. Can someone help me with the code needed. I've tried: me.line1.move top:3.4545
but this doesn't work. Thanks

Geno
 
Access will automatically remove excess vertical space.
1. Set the section's CanShrink and CanGrow properties to yes
2. Set the CanShrink and CanGrow properties to yes for all controls in the section.
3. Make sure that the controls do not overlap
4. Make sure that labels on a line with no data are also hidden -
Code:
If IsNull(Me.SomeField) Then
    Me.SomeField_lbl.Visible = False
Else
    Me.SomeField_lbl.Visible = True
End If
5. Make sure that you remove extra vertical space between lines in the section since that space will not be removed by Access.
 
Hi Pat,
I do have all the controls set to can shrink and can grow, and the line does move up a little but I would like to move the line about an inch further up on the report.
 
Trouble applying this to subreports

I was able to use Pat's code to hide fields when there is no data and eliminate wasted space and it worked perfectly.

Now, however, I want to use that report as a subreport. On it's own the visible/not visible issue still works, but when I open the mainform and view the subform data, my null fields are shown. I tried putting the same code in the main form, adding a reference to the subform, but it does nothing. Does anyone know what I might be missing. Here is my code:

Private Sub Report_Activate()
If IsNull(Me.WiscIV_subreport.WiscIVFsiqSt) Then
Me.WiscIV_subreport.WiscIVFsiqSt_Label.Visible = False
Else
Me.WiscIV_subreport.WiscIVFsiqSt_Label.Visible = True
End If

If IsNull(Me.WiscIV_subreport.WiscIVFsiqSt) Then
Me.WiscIV_subreport.WiscIVFsiqSt.Visible = False
Else
Me.WiscIV_subreport.WiscIVFsiqSt.Visible = True
End If
End Sub

Thanks!
 
Try using If IsNull(Me.WiscIV_subreport.WiscIVFsiqSt.value)
 
Object does not support this property or method.

I get the following error and no results with or without using ".value":

Object does not support this property or method.

Any thoughts?
 
Put the code in the report you are trying to modify. Do not attempt to control visibility of subreport controls from the main report. Control subreport controls from the subreport itself.
 
Do not attempt to control visibility of subreport controls from the main report. Control subreport controls from the subreport itself.

This is what I was doing the first time. When I do this and open the subreport on its own, it works beautifully. When I view it as part of the main report, the code takes no effect. Any idea what could be causing the discrepancy?

Thanks,
Carly
 
The critiera that the main report opens with may be not the same as your subreport....
 
I've tried the code in the main report and subreport OnOpen and OnActivate events. Same story.
 

Users who are viewing this thread

Back
Top Bottom