Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    start printing report at specific line on page (2003 all updates)

    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.

    <pre>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</pre>


    I have placed the "- - - - -" lines in the above just for ease of showing where the various code pieces start and end.

    Can anyone spot how to either fix this, or show a better method for achieving the desired result?

    Thanks.

    Tom

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: start printing report at specific line on page (2003 all updates)

    In what sense doesn't the code work?
    - It produces an error message - if so, what does it say?
    - It doesn't do anything at all
    - It does something but not what was intended - if so, how is it different?

  3. #3
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: start printing report at specific line on page (2003 all updates)

    Sorry. I should have made that clear.

    No error message.

    It doesn't do anything at all. Irrespective of what value you enter in frmInputBox, the result is the same - i.e. no movement down the page.

    Tom

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: start printing report at specific line on page (2003 all updates)

    Nothing catches my eye immediately. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  5. #5
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: start printing report at specific line on page (2003 all updates)

    Here's a really stripped down database zip file.

    Tom
    Attached Files Attached Files

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: start printing report at specific line on page (2003 all updates)

    The text box txtMySpc is intended to push the text down by filling it with the required number of line breaks. But you have hidden this text box by setting its Visible property to No. A hidden text box doesn't have any effect on the visible controls.
    If you set its Visible property to Yes, it should work.

  7. #7
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: start printing report at specific line on page (2003 all updates)

    Hans
    Yep, that did it!!

    Thanks.

    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •