Using Access 2003
A form opens and the user selects a name for which to print Memorial Donations on a booklet page. There may or may not already be entries printed on the page, so the user is asked to determine how many inches from the top of the page to begin printing. This is done through a pop-up form, frmInputBox, and the user enters the appropriate #(8 = 1 inch).
Below is code that always worked with Access 2000. However, this does not work since we switched to Access 2003.
The OLE boxes are either printed or not printed depending upon whether it's a new page upon which printing starts.
Text25 is data - name for whom donations are made etc. - that comes from the form that calls the report.
MyInt is a non-visible tiny text box in the report header.
MySpc is the value that comes from frmInputBox.
I have placed the "- - - - -" lines in the above just for ease of showing where the various code pieces start and end.
There is no error when the code runs. It just doesn't do anything. Irrespective of what the value entered in frmInputBox there is no effect.
Can anyone spot how to either fix this, or show a better method for achieving the desired result?
Thanks.
Tom
A form opens and the user selects a name for which to print Memorial Donations on a booklet page. There may or may not already be entries printed on the page, so the user is asked to determine how many inches from the top of the page to begin printing. This is done through a pop-up form, frmInputBox, and the user enters the appropriate #(8 = 1 inch).
Below is code that always worked with Access 2000. However, this does not work since we switched to Access 2003.
The OLE boxes are either printed or not printed depending upon whether it's a new page upon which printing starts.
Text25 is data - name for whom donations are made etc. - that comes from the form that calls the report.
MyInt is a non-visible tiny text box in the report header.
MySpc is the value that comes from frmInputBox.
Code:
Option Compare Database
Option Explicit
Public MySpc As String
Public myInt As Integer
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
If Me.Page = 1 And Me.txtShowInt <= 2 Then
Me.OLEUnbound1.Visible = True
Else
Me.OLEUnbound1.Visible = False
End If
If Me.Page > 1 Then
Me.OLEUnbound1.Visible = True
End If
End Sub
'- - - - -
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
If Me.Page = 1 Then
Me.Text25.Visible = False
Else
Me.Text25.Visible = True
End If
If Me.Page = 1 And Me.txtShowInt <= 2 Then
Me.OLEUnbound0.Visible = True
Me.Label2.Visible = True
Else
Me.OLEUnbound0.Visible = False
Me.Label2.Visible = False
End If
If Me.Page > 1 Then
Me.OLEUnbound0.Visible = True
Me.Label2.Visible = True
End If
End Sub
'- - - - -
Private Sub Report_Close()
DoCmd.Close acForm, "frmInputBox"
Dim i As Integer
For i = 0 To Forms!frmMemorialBook!List2.ListCount - 1
Forms!frmMemorialBook!List2.Selected(i) = False
Next i
Forms!frmMemorialBook!txtSelected = Null
Forms!frmMemorialBook!Text19 = Null
Forms!frmMemorialBook!txtFund = Null
End Sub
'- - - - -
Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "frmInputBox", WindowMode:=acDialog
End Sub
'- - - - -
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Dim myInt As Integer
On Error GoTo ReportHeader_Format_Error
MySpc = ""
myInt = 0
If Me.Page < 2 Then
For myInt = 2 To Forms!frmInputBox!txtResponse
MySpc = MySpc & vbNewLine '& myInt
Me.txtMySpc = MySpc
Next myInt
Me.txtShowInt = myInt
End If
On Error GoTo 0
Exit Sub
ReportHeader_Format_Error:
If Err.Number = 13 Then
Me.txtShowInt = 0
Exit Sub
Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ReportHeader_Format of VBA Document Report_rptMemTest"
End If
End Sub
I have placed the "- - - - -" lines in the above just for ease of showing where the various code pieces start and end.
There is no error when the code runs. It just doesn't do anything. Irrespective of what the value entered in frmInputBox there is no effect.
Can anyone spot how to either fix this, or show a better method for achieving the desired result?
Thanks.
Tom