Results 1 to 7 of 7
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Solutions to Possible db Corruption

    I have a mysterious bug that keeps popping up. I'm afraid my db has been corrupted, but I'm not sure or how to fix it if it is.

    I've ripped it apart a dozen times and I'm just getting more confused. There are several eyebrow raising things going on here.

    I am checking the record count of a UNION query to make sure each query is returning a record. If not I do not want to run the report and also want to offer the user the option of viewing the underlying data.



    Here's the simplest way I've tried to accomplish this using the DCount function. I keep getting runtime error 13: Type Mismatch using the message box. I've used message boxes for this thousands of times. I can't figure out why this is happening.

    Code:
    Private Sub cmdEnhancedCaseManagement_Click()
        
        On Error GoTo errHandler
        
        Dim intResponse As Integer
        Dim intCount as Integer
    
    
            intCount = DCount("*", "qryECM_Report_1")
    
    
            If intCount < 3 Then
    
    
                intResponse = MsgBox("No records qualify for either the F2F or InHome numerators." & vbNewLine And vbNewLine & _
                        "Do you wish to review your data?", vbYesNo)
                If intResponse = 6 Then DoCmd.RunMacro "macECM_ExportDenominator"
    
    
            End If
    
    
                GoTo ExitSub
            
        DoCmd.OpenReport "rptEnhancedCaseManagement", acViewReport
    
    
    ExitSub:
    
    
        Exit Sub
        
    errHandler:
    
    
        MsgBox Err.Number & ": " & Err.Description
        GoTo ExitSub
    
    
    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    I keep getting corruptions, and Microsoft has yet to fix it:
    https://support.microsoft.com/en-us/...6-d3a7c422dc1d


  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    & vbNewLine And vbNewLine & _

    should be


    & vbNewLine & vbNewLine & _

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Good eyes, Dave!

    I can never remember the return values for vbYes, vbNo etc, so I use code like this instead

    Code:
    If intCount < 3 Then    
        If MsgBox("No records qualify for either the F2F or InHome numerators." & vbNewLine & vbNewLine & _
           "Do you wish to review your data?", vbYesNo) = vbYes Then 
            DoCmd.RunMacro "macECM_ExportDenominator"
        End If
    End If
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    Paul H's Avatar
    Paul H is offline Expert
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Quote Originally Posted by davegri View Post
    & vbNewLine And vbNewLine & _
    should be
    & vbNewLine & vbNewLine & _
    I swear to God I didn't do that. Probably in the course of pulling my hair out I made that mistake. I'm kicking myself right now, but my head feels much better.

  6. #6
    Paul H's Avatar
    Paul H is offline Expert
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Quote Originally Posted by isladogs View Post
    Good eyes, Dave!

    I can never remember the return values for vbYes, vbNo etc, so I use code like this instead

    Code:
    If intCount < 3 Then    
        If MsgBox("No records qualify for either the F2F or InHome numerators." & vbNewLine & vbNewLine & _
           "Do you wish to review your data?", vbYesNo) = vbYes Then 
            DoCmd.RunMacro "macECM_ExportDenominator"
        End If
    End If
    I tried that, but davegri showed the very bone headed error in my code.

    Thanks everybody for your quick replies.

    Paul
    Last edited by Paul H; 12-03-2020 at 12:49 PM.

  7. #7
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    The next best thing to a second set of eyes constantly looking over our shoulder is coming to this forum!
    Thanks for the star.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-04-2020, 01:06 AM
  2. VBA Color Pickers, x64 solutions
    By ironfelix717 in forum Programming
    Replies: 4
    Last Post: 03-08-2020, 07:12 PM
  3. DB hosting solutions
    By ahill48 in forum Access
    Replies: 8
    Last Post: 08-20-2017, 10:26 AM
  4. Solutions for reaching data limits?
    By drr1970 in forum Access
    Replies: 3
    Last Post: 08-08-2017, 06:52 PM
  5. Multiuser Access Solutions?
    By GaryE in forum Access
    Replies: 4
    Last Post: 04-16-2013, 06:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums