Weird Access Database report errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anoble1
    New Member
    • Jul 2008
    • 246

    Weird Access Database report errors

    Hi all,

    I am running into a weird problem in my MS Access report Database. I created it the other day. It has a general main screen that has a drop down report with 2 limits on it. Well, if you choose the report and go to the first limit and view, nothing comes up every time when you start the DB. But, when you restart the db, and select the report and try the 2nd limit, it works. Then when you try the 1st limit it works.

    In order for the 1st limit to work you must open the db. and either run BOTH limits, or run the second limit, let the report open, then close it, then run the first one. I'm not sure whats going on.
    The account type is the one giving me problems. I hope I could explain it well enough.

    Here is my code, maybe it will be enough.

    Code:
    Public Function GetWhereCond() As String
    Dim whereCond As String
    
        With Forms!frmMain
        
            'These are for Future Reference if I can find where these are stored
            If Nz(!ServiceNumber.Value, "") <> "" Then whereCond = whereCond & " AND (ServiceNumber = " & """" & !ServiceNumber.Value & """" & ")"
            If Nz(!MTWAccount.Value, "") <> "" Then whereCond = whereCond & " AND (ServiceNumber = " & """" & !MTWAccount.Value & """" & ")"
            If Nz(!InvoiceGroup.Value, "") <> "" Then whereCond = whereCond & " AND (ServiceNumber = " & """" & !InvoiceGroup.Value & """" & ")"
            If Nz(!RetailAccount.Value, "") <> "" Then whereCond = whereCond & " AND (ServiceNumber = " & """" & !RetailAccount.Value & """" & ")"
        
            'I haven't decided where to pull the Date Field from so I put in a General Name
            'If Nz(!HighDate, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.DATE >= #" & !HighDate.Value & "#)"
            'If Nz(!LowDate, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.DATE <= #" & !LowDate.Value & "#)"
            
            'If Nz(!cmbRegion, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.CustomerState = '" & !cmbRegion.Value & "')"
            If Nz(!cmbAccountType, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.AccountType = " & !cmbAccountType.Value & ")"
            If Nz(!cmbAccountStatus, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.AccountStatus = " & !cmbAccountStatus.Value & ")"
            
            
        End With
        
        If whereCond = "" Then
            GetWhereCond = ""
        Else
            GetWhereCond = "(" & Right(whereCond, Len(whereCond) - 5) & ")"
        End If
    
    End Function
    PS. Let me add that when I open the db, and select the report and hit view. The report is blank, but if I open it and click on a drop down and clear everything out, it works fine and populates.
    Last edited by NeoPa; May 17 '12, 12:32 PM. Reason: Merged posts to have the complete question in the question post.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    No idea what you mean by "limit", which makes it hard to understand the question.

    Comment

    • anoble1
      New Member
      • Jul 2008
      • 246

      #3
      Sorry,

      The limits I have are drop down boxes.
      Last edited by NeoPa; May 18 '12, 12:04 AM. Reason: Quote unnecessary.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        I tried interpreting your explanation with that in mind but it makes no more sense than the first version. If you really want some help then surely it makes sense to put a little more effort into your explanation. I'm happy to help, but not so keen that I want to read through all your code to try to work out what you should have said in the first place - on the off-chance that it all falls into place then. Does that make sense?

        Comment

        Working...