Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2010
    Posts
    186

    Unanswered: ACCESS 07 Report won't open

    I built a database on my company network that only I use.

    I've got a report, mrSO, I open with query defs in an onclick, cmdOUT
    I run this everyday - until last Thursday when I did compact & repair before I closed out.
    This report won't open anymore. Can anyone suggest what may have happened as the code was not changed at all? I ran analysis and compiled code but neither worked?
    Here's the code...........
    command button:
    Code:
    Private Sub cmdOUT_Click()
    Dim DB As DAO.Database
    Dim QDF1 As QueryDef
    Dim where As Variant
    
    Set DB = CurrentDb()
    
    On Error Resume Next
    DB.QueryDefs.Delete ("GoalsA")
    On Error GoTo 0
    
    where = where & " AND (IsNull([Unapplied]))"
    where = where & " AND ([Salesrep1] Like '*" & [txtWCIGslmn] & "*' OR [SLMN2] Like '*" & [txtWCIGslmn] & "*' OR [SLMN3] Like '*" & [txtWCIGslmn] & "*')"
    where = where & " AND ([BAL] Is Null OR [BAL] > 0)"
    where = where & " AND ((([DUE]>Date())=0))"
    where = where & " AND (IsNull([ICID]))"
    
    
    Set QDF1 = DB.CreateQueryDef("GoalsA", "Select * From qryMainReport1" & (" where " & Mid(where, 6) & ";"))
    DoCmd.OpenReport "mrSO", acViewPreview
    
    
    End Sub
    I know that the onclick is working because DoCmd.OpenReport is triggering...if you see below I have a function Report_Open that opens 2 queries. Those open, then access shows Formatting and Running Query at bottom right, but the report mrSO doesn't open......the 2 queries close and then I'm back to my form with cmdOUT?

    I can't identify why there is a hangup now when it tries to open, and why it is jumping to Report_Close which triggers the queries to close?

    Any suggestions to fix or change would be greatly appreciated! (Although, this worked for me as is since I created it)

    report:
    Code:
    Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
        If Me.srFAKES.Report.HasData Then
            Me.srFAKES.Visible = True
            End If
                If Me.SlmnOutstandingCM.Report.HasData Then
                    Me.SlmnOutstandingCM.Visible = True
                    End If
          
    End Sub
                    
        
    Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
        If Me.srCPO.Report.HasData Then
            Me.srCPO.Visible = True
            Else
            Me.srCPO.Visible = False
            End If
                If Me.srNOTES.Report.HasData Then
                Me.srNOTES.Visible = True
                Else
                Me.srNOTES.Visible = False
                End If
                    If Me.Slmn_OutstandingCI.Report.HasData Then
                    Me.Slmn_OutstandingCI.Visible = True
                    Else
                    Me.Slmn_OutstandingCI.Visible = False
                    End If
                        If Me.SlmnOutstandingCO.Report.HasData Then
                        Me.SlmnOutstandingCO.Visible = True
                        Else
                        Me.SlmnOutstandingCO.Visible = False
                        End If
    End Sub
    
    Private Sub Report_Close()
    DoCmd.Close acQuery, "TotalsA"
    DoCmd.Close acQuery, "GrandTotalsA"
    End Sub
    
    Private Sub Report_Open(Cancel As Integer)
    Dim DBSO1 As DAO.Database
    Dim DBSO2 As DAO.Database
    Dim QSO1 As QueryDef
    Dim QSO2 As QueryDef
    Dim where As Variant
    
    Set DBSO1 = CurrentDb()
    Set DBSO2 = CurrentDb()
    
    On Error Resume Next
    DBSO1.QueryDefs.Delete ("TotalsA")
    DBSO2.QueryDefs.Delete ("GrandTotalsA")
    On Error GoTo 0
    
    where = where & " AND ([Salesrep1] Like '*" & [Forms]![WCIGChooser]![txtWCIGslmn] & "*' OR [SLMN2] Like '*" & [Forms]![WCIGChooser]![txtWCIGslmn] & "*' OR [SLMN3] Like '*" & [Forms]![WCIGChooser]![txtWCIGslmn] & "*')"
    where = where & " AND ((([DUE]>Date())=0))"
    
    Set QSO1 = DBSO1.CreateQueryDef("TotalsA", "Select * From qryMainReport2" & (" where " & Mid(where, 6) & ";"))
    DoCmd.OpenQuery "TotalsA"
    Set QSO2 = DBSO2.CreateQueryDef("GrandTotalsA", "Select * From qryMainReport2" & (" where " & Mid(where, 6) & ";"))
    DoCmd.OpenQuery "GrandTotalsA"
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    are the queries returnign data
    do you have code in an on nodata event
    remove the on error resume next and see what error is being reported
    compile the application and see if there are compilation errors
    if that fails try importing into a new access file

    there is a utility that can recover from (some) Access weirdo issues, but I wouldn't try that just yet.

    of course you could use the backup you created before using comapct and repair... you did use a backup I take it
    Last edited by healdem; 08-21-13 at 13:46.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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