G
Guest
This may take a minute to explain, so kindly bear with me. I'm using Office
XP.
I'm in charge of making sure Nursing students are up to date in their
documentation. I've already automated Access emailing these students when
their various documentation expires. What I'm trying to do now is produce a
report that will give me a hard copy for quickly looking up the state of
various students.
Specifically, I want the report to list students who are missing
documentation and then indicating just what documentation they need. In
order to save space (I'd like it on one page), I'm not leaving any blank
space for unusued fields. Output for each student will look like this:
Name: MMR
PPD
HepB
with the list containing only the elements needed. I've been doing this by
making seven controls on the detail area. Each of these controls is
initially set to Height=0 and placed at the same location. The code in the
Detail_Format routine determines if each control in turn is blank. If it is
not, the control is moved do beneath the last resized control and the height
is expanded. Afterwards, a box that visually unites the tags thus produced
is resized and the detail area is sized to the controls.
It works great in theory, but in practice, this is frequently producing lots
of extra space for no reason I can see.
Any help would be appreciated. Here is the code I'm using:
Option Compare Database
Option Explicit
Private ReportControls(0 To 6) As Control
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Const BoxMargin As Long = 60
Const NewHeight As Long = 240
Dim NextTop As Long
Dim X As Integer
NextTop = BoxMargin
Detail.Height = 30000
For X = 0 To 6
With ReportControls(X) 'ReportControls Array is filled in
Report_Open for efficiency.
If .Value <> "" Then
.Top = NextTop
.Height = NewHeight
NextTop = NextTop + NewHeight
End If
End With
Next X
boxFrameValues.Height = NextTop + BoxMargin
Detail.Height = Max(boxFrameValues.Height, txtName.Height)
End Sub
Private Sub Report_Open(Cancel As Integer)
Set ReportControls(0) = txtMMR
Set ReportControls(1) = txtHepB
Set ReportControls(2) = txtTet
Set ReportControls(3) = txtLic
Set ReportControls(4) = txtCPR
Set ReportControls(5) = txtPPD
Set ReportControls(6) = txtPPDX
End Sub
XP.
I'm in charge of making sure Nursing students are up to date in their
documentation. I've already automated Access emailing these students when
their various documentation expires. What I'm trying to do now is produce a
report that will give me a hard copy for quickly looking up the state of
various students.
Specifically, I want the report to list students who are missing
documentation and then indicating just what documentation they need. In
order to save space (I'd like it on one page), I'm not leaving any blank
space for unusued fields. Output for each student will look like this:
Name: MMR
PPD
HepB
with the list containing only the elements needed. I've been doing this by
making seven controls on the detail area. Each of these controls is
initially set to Height=0 and placed at the same location. The code in the
Detail_Format routine determines if each control in turn is blank. If it is
not, the control is moved do beneath the last resized control and the height
is expanded. Afterwards, a box that visually unites the tags thus produced
is resized and the detail area is sized to the controls.
It works great in theory, but in practice, this is frequently producing lots
of extra space for no reason I can see.
Any help would be appreciated. Here is the code I'm using:
Option Compare Database
Option Explicit
Private ReportControls(0 To 6) As Control
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Const BoxMargin As Long = 60
Const NewHeight As Long = 240
Dim NextTop As Long
Dim X As Integer
NextTop = BoxMargin
Detail.Height = 30000
For X = 0 To 6
With ReportControls(X) 'ReportControls Array is filled in
Report_Open for efficiency.
If .Value <> "" Then
.Top = NextTop
.Height = NewHeight
NextTop = NextTop + NewHeight
End If
End With
Next X
boxFrameValues.Height = NextTop + BoxMargin
Detail.Height = Max(boxFrameValues.Height, txtName.Height)
End Sub
Private Sub Report_Open(Cancel As Integer)
Set ReportControls(0) = txtMMR
Set ReportControls(1) = txtHepB
Set ReportControls(2) = txtTet
Set ReportControls(3) = txtLic
Set ReportControls(4) = txtCPR
Set ReportControls(5) = txtPPD
Set ReportControls(6) = txtPPDX
End Sub