Prev: Show Button
Next: After Update If
From: TAZ1NOLES on 8 Jan 2010 13:26 I have tried the following 2 sets of Event Procedures to hide fields on a form when the data in another control = NO but no matter what I do the fields still appear on the form & the print preview. Any thoughts or assistance would be greatly appreciated! *********************************************************** Private Sub CABLE_TAGS_PRESENT_AfterUpdate() If Me.[CABLE_TAGS_PRESENT] = "No" Then Me.[CABLE_TAGS_READABLE].Visible = False Else: Me.[CABLE_TAGS_READABLE].Visible = True End If End Sub *********************************************************** Private Sub PRIMARY_CABLE_REPLACEMENT_AfterUpdate() If Me.[PRIMARY CABLE REPLACEMENT] = "No" Then Me.[PRIMARY CABLE COMMENTS].Visible = False Me.[CABLE_FEEDER__1].Visible = False Me.[CABLE_FEEDER__2].Visible = False Me.[CABLE_FEEDER__3].Visible = False Me.[CABLE_FEEDER__4].Visible = False Else: Me.[PRIMARY CABLE COMMENTS].Visible = True Me.[CABLE_FEEDER__1].Visible = True Me.[CABLE_FEEDER__2].Visible = True Me.[CABLE_FEEDER__3].Visible = True Me.[CABLE_FEEDER__4].Visible = True End If End Sub -- PAT FEARNS
From: scott04 on 8 Jan 2010 13:42 Any reason your using []? "TAZ1NOLES" wrote: > I have tried the following 2 sets of Event Procedures to hide fields on a > form when the data in another control = NO but no matter what I do the fields > still appear on the form & the print preview. Any thoughts or assistance > would be greatly appreciated! > > *********************************************************** > > Private Sub CABLE_TAGS_PRESENT_AfterUpdate() > If Me.[CABLE_TAGS_PRESENT] = "No" Then > Me.[CABLE_TAGS_READABLE].Visible = False > Else: Me.[CABLE_TAGS_READABLE].Visible = True > End If > > End Sub > > *********************************************************** > > Private Sub PRIMARY_CABLE_REPLACEMENT_AfterUpdate() > If Me.[PRIMARY CABLE REPLACEMENT] = "No" Then > Me.[PRIMARY CABLE COMMENTS].Visible = False > Me.[CABLE_FEEDER__1].Visible = False > Me.[CABLE_FEEDER__2].Visible = False > Me.[CABLE_FEEDER__3].Visible = False > Me.[CABLE_FEEDER__4].Visible = False > Else: Me.[PRIMARY CABLE COMMENTS].Visible = True > Me.[CABLE_FEEDER__1].Visible = True > Me.[CABLE_FEEDER__2].Visible = True > Me.[CABLE_FEEDER__3].Visible = True > Me.[CABLE_FEEDER__4].Visible = True > End If > > End Sub > -- > PAT FEARNS
From: Linq Adams via AccessMonster.com on 8 Jan 2010 14:00 What kind of field is [CABLE_TAGS_PRESENT]? If it a boolean field with a checkbox or radio button on the form the code would be [CABLE_TAGS_PRESENT] = False or [CABLE_TAGS_PRESENT] = 0 rather than [CABLE_TAGS_PRESENT] = "No" which denotes a Texst value, i.e. a textbox whose content is actually the word "No" -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201001/1
From: Daryl S on 8 Jan 2010 14:09 Could your control CABLE_TAGS_PRESENT be boolean? If so, compare it to FALSE rather than "No". If it is text, then "No" should work. Have you stepped through the code? (Set a breakpoint on the line with Me.[CABLE_TAGS_READABLE].Visible = False and step through the process. Do you get any errors? Does the code run? Also, this will only run after a change in the CABLE_TAGS_PRESENT value on the form. If this field is stored, then you will not see the fields hidden when you open the form unless you also call this code on the form current event. -- Daryl S "TAZ1NOLES" wrote: > I have tried the following 2 sets of Event Procedures to hide fields on a > form when the data in another control = NO but no matter what I do the fields > still appear on the form & the print preview. Any thoughts or assistance > would be greatly appreciated! > > *********************************************************** > > Private Sub CABLE_TAGS_PRESENT_AfterUpdate() > If Me.[CABLE_TAGS_PRESENT] = "No" Then > Me.[CABLE_TAGS_READABLE].Visible = False > Else: Me.[CABLE_TAGS_READABLE].Visible = True > End If > > End Sub > > *********************************************************** > > Private Sub PRIMARY_CABLE_REPLACEMENT_AfterUpdate() > If Me.[PRIMARY CABLE REPLACEMENT] = "No" Then > Me.[PRIMARY CABLE COMMENTS].Visible = False > Me.[CABLE_FEEDER__1].Visible = False > Me.[CABLE_FEEDER__2].Visible = False > Me.[CABLE_FEEDER__3].Visible = False > Me.[CABLE_FEEDER__4].Visible = False > Else: Me.[PRIMARY CABLE COMMENTS].Visible = True > Me.[CABLE_FEEDER__1].Visible = True > Me.[CABLE_FEEDER__2].Visible = True > Me.[CABLE_FEEDER__3].Visible = True > Me.[CABLE_FEEDER__4].Visible = True > End If > > End Sub > -- > PAT FEARNS
From: TAZ1NOLES on 8 Jan 2010 15:39
This is in answer to the 3 posts from Linq-DarylS & Scott04 1) I took off the brackets & it didn't help! 2) All of these fields are text & NO is an answer criteria of the CABLE TAGS PRESENT field! 3) I tried adding the code to the OnCurrent event of the form & it didn't make any difference. 4) With the brackets off I received errors about usage of Me. 5) I had to eliminate the Else: statement or received errors also. Relatively back to square 1. Thanks for your & any other help! -- PAT FEARNS "Linq Adams via AccessMonster.com" wrote: > What kind of field is [CABLE_TAGS_PRESENT]? If it a boolean field with a > checkbox or radio button on the form the code would be > > [CABLE_TAGS_PRESENT] = False > > or > > [CABLE_TAGS_PRESENT] = 0 > > rather than > > [CABLE_TAGS_PRESENT] = "No" > > which denotes a Texst value, i.e. a textbox whose content is actually the > word "No" > > -- > There's ALWAYS more than one way to skin a cat! > > Answers/posts based on Access 2000/2003 > > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201001/1 > > . > |