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

Hide a Text Box based on Combo Box selection

P: 7
Hello, I am working on an Access 2007 database and I am having issues on a multiple record form, getting a text box control (titled: IOPCount) to be hidden unless a combo box control (titled: Request_Type) indicates the value "OBS/SUP".

I located a rather fantastic post on this site (here) but when I use this code and I change the Request_Type control of 1 record it hides or unhides the IOPCount control of ALL records. here is the code I used from the above link:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Request_Type_AfterUpdate()
  2.  
  3. If Request_Type = "OBS/SUP" Then
  4.  
  5.           IOPCount.Visible = True     'Set text box to visible
  6.  
  7.      Else
  8.           IOPCount.Visible = False     'Hide the text box
  9.  
  10.      End If
  11.  
  12. End Sub
My question is: "How do I get this code to only hide the IOPCount control of the record it is associated with?"
Jan 6 '14 #1

✓ answered by TheSmileyCoder

Hi and welcome to Bytes
You can't do that sadly, in that way. The controls in a continuous form are "repeated" so to say between records, and as such they share certain properties, such as the .Visible property.

The best you can do in a continuous form is to use conditional formatting.

Share this Question
Share on Google+
6 Replies


TheSmileyCoder
Expert Mod 100+
P: 2,321
Hi and welcome to Bytes
You can't do that sadly, in that way. The controls in a continuous form are "repeated" so to say between records, and as such they share certain properties, such as the .Visible property.

The best you can do in a continuous form is to use conditional formatting.
Jan 6 '14 #2

NeoPa
Expert Mod 15k+
P: 31,261
DJChaney3
"... but when I use this code and I change the Request_Type control of 1 record ..."
Therein lies the rub. Form controls are not related to any record. They are related to the form. Different instances may show different data, but the control itself is the same whichever record is currently being shown. Any change to the properties of that control will affect any and all records that are shown using that control.

Why Values in Unbound Form Controls do not Persist may be helpful to read for a fuller understanding.
Jan 6 '14 #3

P: 7
Thank you very much. I have switched over to use Conditional formatting. However I ran into the issue with this were I can not conditionally format the label... why I am not sure but it will not allow it :(

Any idea on that one?
Jan 7 '14 #4

TheSmileyCoder
Expert Mod 100+
P: 2,321
I don't really know, as I haven't used it much myself. For me to give any troubleshooting tips however, you need to provide more details on
* What have you tried
* Explain what Access is doing, and what you expected it to do
Jan 7 '14 #5

zmbd
Expert Mod 5K+
P: 5,287
djchaney3: New Question New Thread (^_^)
Jan 7 '14 #6

P: 7
Sorry for a second question under same post, but I did figure it out. Thank you all for assisting me
Jan 7 '14 #7

Post your reply

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