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

Report not hiding a control

Seth Schrock
Expert 2.5K+
P: 2,941
I have a report that has a control called Status. If that control says Approved, then I want another control called MortgageRate to be visible. If the Status control says Denied, then I want the MortgageRate control to not be visible. However, it is always visible. Here is the code that I'm using in the report's OnCurrent event
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Current()
  2.  
  3. Select Case Me.Status
  4.     Case "Denied"
  5.         Me.MortgageRate.Visible = False
  6.  
  7.     Case "Approved"
  8.         Me.MortgageRate.Visible = True
  9.  
  10. End Select
  11.  
  12. End Sub
  13.  
I noticed that the Visible property didn't come up in the Intellisense prompt so I'm not sure if that has anything to do with it, but the program debugs okay (option explicit is set). Not sure what is wrong.
Dec 2 '13 #1
Share this Question
Share on Google+
5 Replies


zmbd
Expert Mod 5K+
P: 5,397
Line 2: debug.print Me.Status
Compare the case of the immediate with the case of the select.
Ucase<>Lcase

I usually convert the case of text results using one of the string-case functions and use all lower/UPPER letter case in the select construct.
Dec 3 '13 #2

Seth Schrock
Expert 2.5K+
P: 2,941
Well, I discovered that the OnCurrent event doesn't run automatically when the report is opened. So I placed my code in the Details - OnFormat event. The problem now is that the Visible property gets a compile error. Method or data member not found. It didn't have a problem compiling with the code that I had in the OnCurrent event. Googling what to try next, but nothing so far :(
Dec 3 '13 #3

zmbd
Expert Mod 5K+
P: 5,397
what type of control is " Me.MortgageRate"
Dec 3 '13 #4

Seth Schrock
Expert 2.5K+
P: 2,941
Never mind. I just had to fix my control name to be different from the control source. I knew it had to be a stupid mistake on my part.
Dec 3 '13 #5

zmbd
Expert Mod 5K+
P: 5,397
Glad you found the fix as I was begining to run out of ideas. Wouldn't have thought to have you check the control source (>_<)
Dec 3 '13 #6

Post your reply

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