How to make text box appear?

XQuestion

New member
Local time
Today, 03:28
Joined
Aug 30, 2005
Messages
5
I haven't used Access in a looooong time and building a document tracking database for work. I am setting up my data entry form and would like to have a text box appear depending on the selection from a combo box. So, if the user selects "In Review" a text box will appear for entry of the reviewer's name, likewise if the user selects, "In Work." In the other cases (options in the combo box) the document is not being revised, so no name needs to be entered--so no need for the additional text box. Make sense? Any guidance/advice as to how to go about this? Thank you!
 
Put code similar to this in the AfterUpdate() event of the combo box which triggers the change...

If Not IsNull(<COMBO BOX>) Then
Select Case <COMBO BOX>​
Case "In Review", "In Work"​
<CONTROL>.Visible = True​
Case Else​
<CONTROL>.Visible = False​
End Select​
Else
<CONTROL>.Visible = False​
End If
 
Last edited:
Hmm, this makes sense but I can't make it work--meaning the control is visible when I start and doesn't go anywhere regardless of what I choose from the combo box. Might I be missing something in my form setup?
 
You've mentioned 2 problems:

1. STARTING VISIBILITY
Since the code I mentioned should only be triggered when the combo box is changed, the opening of the form leaves the control is whatever visibility state is default. Solution: Open form in Design View and set the Visible property of the control in question to False. This will ALWAYS start the control at False which seems logical since when the form first opens it isn't possible that the user has made a selectton first.

2. EVENT NOT WORKING
A couple possible reasons: A.) Have you linked to code to the correct event? Check the properties of the control box to see this B.) Have you written the code right? Have you told the code to switch visibilty from False to True? C.) Is the code failing for another reason. To check this, go into the code and add a 'Code Stop' on the first line of the code. Then change form to Form View, change the combo and see if the code is triggered (code will stop at the line you selected). You can then step through the code line by line using F8 I think.
 

Users who are viewing this thread

Back
Top Bottom