Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003

    Unanswered: Checking parameter values against report values

    Hi basically what I have is a hard copy master report with totals on it and I'd like to print off other reports based on the totals in the master. I'm trying to automate it so that a report will only print if the total matches the corresponding total in the master report.

    I was thinking firstly of creating a form where the user can type in the totals and they can be stored in a table. What I then need is a way to match the inputted totals with the totals in the reports.

    Firstly, is there a way to do this? Say I have a form called input_form, the user types values into here and are stored in input_table. I want to check the total value in report1 against the total value for the corresponding field in input_table.

    thanks in advance,


  2. #2
    Join Date
    Nov 2003
    Give something like this a try....Place the following code into the OnFormat event located within the Details section of your report. For Example:

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        Dim dbs As Database
        Dim rst As Recordset
        On Error Resume Next
        Set dbs = CurrentDb
        Set rst = dbs.OpenRecordset("input_table")
        If Err Then GoTo NoRecds
        Do Until rst.EOF
          If Me.reportRecordIDField = rst!tableRecordID Then
             If Me.reportTOTALVALUE <> rst!tableTotalValue Then
                MsgBox "TOTALS ERROR:@@" & "Report total does not match up. " & _
                "Please check Data.", vbExclamation, "Totals Error"
             End If
             Exit Do
          End If
        Set dbs = Nothing
    End Sub
    Or something like this...

  3. #3
    Join Date
    Jun 2003
    Hi thanks for the help, I'm getting a user type defined error at the line

    Dim dbs As Database

    I'm using Access 2000 is this part of the problem or am I missing something else?


Posting Permissions

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