By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,660 Members | 1,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,660 IT Pros & Developers. It's quick & easy.

Weird Access Database report errors

anoble1
100+
P: 225
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.

Expand|Select|Wrap|Line Numbers
  1. Public Function GetWhereCond() As String
  2. Dim whereCond As String
  3.  
  4.     With Forms!frmMain
  5.  
  6.         'These are for Future Reference if I can find where these are stored
  7.         If Nz(!ServiceNumber.Value, "") <> "" Then whereCond = whereCond & " AND (ServiceNumber = " & """" & !ServiceNumber.Value & """" & ")"
  8.         If Nz(!MTWAccount.Value, "") <> "" Then whereCond = whereCond & " AND (ServiceNumber = " & """" & !MTWAccount.Value & """" & ")"
  9.         If Nz(!InvoiceGroup.Value, "") <> "" Then whereCond = whereCond & " AND (ServiceNumber = " & """" & !InvoiceGroup.Value & """" & ")"
  10.         If Nz(!RetailAccount.Value, "") <> "" Then whereCond = whereCond & " AND (ServiceNumber = " & """" & !RetailAccount.Value & """" & ")"
  11.  
  12.         'I haven't decided where to pull the Date Field from so I put in a General Name
  13.         'If Nz(!HighDate, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.DATE >= #" & !HighDate.Value & "#)"
  14.         'If Nz(!LowDate, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.DATE <= #" & !LowDate.Value & "#)"
  15.  
  16.         'If Nz(!cmbRegion, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.CustomerState = '" & !cmbRegion.Value & "')"
  17.         If Nz(!cmbAccountType, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.AccountType = " & !cmbAccountType.Value & ")"
  18.         If Nz(!cmbAccountStatus, "") <> "" Then whereCond = whereCond & " AND (CUSTOMER.AccountStatus = " & !cmbAccountStatus.Value & ")"
  19.  
  20.  
  21.     End With
  22.  
  23.     If whereCond = "" Then
  24.         GetWhereCond = ""
  25.     Else
  26.         GetWhereCond = "(" & Right(whereCond, Len(whereCond) - 5) & ")"
  27.     End If
  28.  
  29. 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.
May 16 '12 #1
Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,487
No idea what you mean by "limit", which makes it hard to understand the question.
May 17 '12 #2

anoble1
100+
P: 225
Sorry,

The limits I have are drop down boxes.
May 17 '12 #3

NeoPa
Expert Mod 15k+
P: 31,487
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?
May 18 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.