Prev: mscomm32.ocx Windows Xp
Next: Access 2007, Rich Text control. Cannot programmatically change font. Am I mad?
From: samotek via AccessMonster.com on 29 Apr 2010 06:03 Visible controls In my form the code for making controls visible and invisible does not work. My code is the following: Private Sub Form_Current() If Me![supplierid] = 1 Then Me.RaufGrade.Visible = False Me.RaufCode.Visible = False Me.AralGrade.Visible = True Me.AralCode.Visible = True ElseIf Me![supplierid] = 2 Then Me.AralGrade.Visible = False Me.AralCode.Visible = False Me.RaufGrade.Visible = True Me.RaufCode.Visible = True End If End Sub Why is it so? Is it because the form is continous? How can I make it work? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201004/1
From: Al Campagna on 29 Apr 2010 08:25 samotek, This code looks OK if SupplierID is numeric... What does "not work" mean? No error message? Where do you have this code? On the Current of the Main (if any), or the Current of the Subform? Did you Cut & Paste it exactly as you have it? Where is SupplierID? Main? Subform? Please give a little more detail about your form setup, and details about your important form fields and records. Just a suggestion... usually, any field name with ID relates to a key unique field, like CustID, CompanyID, EmployeeID, etc... Sounds like SupplierID is more of a "SupplierType". Definitely not a rule at all... just a "style" thing. Totally your call... -- hth Al Campagna Microsoft Access MVP 2007-2009 http://home.comcast.net/~cccsolutions/index.html "Find a job that you love... and you'll never work a day in your life." "samotek via AccessMonster.com" <u15330(a)uwe> wrote in message news:a73fd764a3eff(a)uwe... > Visible controls > > In my form the code for making controls visible and invisible does not > work. > My code is the following: > Private Sub Form_Current() > If Me![supplierid] = 1 Then > Me.RaufGrade.Visible = False > Me.RaufCode.Visible = False > Me.AralGrade.Visible = True > Me.AralCode.Visible = True > ElseIf Me![supplierid] = 2 Then > Me.AralGrade.Visible = False > Me.AralCode.Visible = False > Me.RaufGrade.Visible = True > Me.RaufCode.Visible = True > End If > End Sub > > Why is it so? Is it because the form is continous? How can I make it work? > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201004/1 >
From: Linq Adams via AccessMonster.com on 29 Apr 2010 11:02
Since the form is ***Continuous*** the controls are going to either be visible or not visible ***depending on the value of SupplierID in the current record*** and this will reflect on ***all records*** in the form. That's the way things work in Continuous orDatasheet forms. With these kinds of forms you have to use Conditional Formatting off of the Format Menu to do formatting. WHile you cannot set the control to visible/invisible using CF, you can diddle it so that the forecolor is the same as the back color under certain conditions, essentially making it "invisible,". -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via http://www.accessmonster.com |