John, Sorry that it took me so long to try this. I had another database to work on. But I wanted to let you know that the NZ worked. Thank you very much.
Jim Wagner ----- Original Message ---- From: John Viescas <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, August 20, 2007 10:10:00 PM Subject: RE: [ms_access] Make visible a text box if a check box has a value as true on a form Jim- When the form opens on a new row and that field has no default value, it is Null. VBA doesn't like trying to do a true/false test on a null. Change it to this: If NZ(Me.FromGoalsAppl , 0) Then That coerces any Null value to 0 - False. John Viescas, author Microsoft Office Access 2007 Inside Out Building Microsoft Access Applications Microsoft Office Access 2003 Inside Out SQL Queries for Mere Mortals http://www.viescas. com/ (Paris, France) For the inside scoop on Access 2007, see: http://blogs. msdn.com/ access/ -----Original Message----- From: [EMAIL PROTECTED] ps.com [mailto:[EMAIL PROTECTED] ps.com] On Behalf Of Jim Wagner Sent: Monday, August 20, 2007 8:25 PM To: [EMAIL PROTECTED] ps.com Subject: Re: [ms_access] Make visible a text box if a check box has a value as true on a form John, the If Me.FromGoalsAppl line in the On Current event is what is highlighted. There is no Default value in the properties for that check box, so I am confused. Private Sub Form_Current( ) If Me.FromGoalsAppl Then Jim Wagner ----- Original Message ---- From: John Viescas <[EMAIL PROTECTED] com> To: [EMAIL PROTECTED] ps.com Sent: Monday, August 20, 2007 10:14:35 AM Subject: RE: [ms_access] Make visible a text box if a check box has a value as true on a form Jim- When you click on Debug, what statement is highlighted? Does your FromGoalsAppl field have a default value? Maybe that's the problem. John Viescas, author Microsoft Office Access 2007 Inside Out Building Microsoft Access Applications Microsoft Office Access 2003 Inside Out SQL Queries for Mere Mortals http://www.viescas. com/ (Paris, France) For the inside scoop on Access 2007, see: http://blogs. msdn.com/ access/ -----Original Message----- From: [EMAIL PROTECTED] ps.com [mailto:ms_access@ yahoogrou ps.com] On Behalf Of Jim Wagner Sent: Monday, August 20, 2007 6:35 PM To: [EMAIL PROTECTED] ps.com Subject: Re: [ms_access] Make visible a text box if a check box has a value as true on a form John. Thanks!!! That worked great except for one problem. The form is set to open at a new record for data entry with a macro.When I open the form I get the Runtime error 94, Invalid use of Null. If I close the error by clicking end or click Debug and just cancel out of the vb window, move to the previous records in the form the box appears as coded and the world is right and happy (at least I am). Is it true that it could be that the form does not have the Primary key entered for that record and cannot be null? So where do I go from here? Jim ----- Original Message ---- From: John Viescas <[EMAIL PROTECTED] com> To: [EMAIL PROTECTED] ps.com Sent: Saturday, August 18, 2007 12:26:30 AM Subject: RE: [ms_access] Make visible a text box if a check box has a value as true on a form Jim- If the label is attached to the text box, then you need hide only the text box. You need code in both the AfterUpdate event of the the check box and the Current event of the form: If Me.FromGoalsAppl Then Me.GoalNo.Visible = True Else Me.GoalNo.Visible = False End If John Viescas, author Microsoft Office Access 2007 Inside Out Building Microsoft Access Applications Microsoft Office Access 2003 Inside Out SQL Queries for Mere Mortals http://www.viescas. com/ (Paris, France) For the inside scoop on Access 2007, see: http://blogs. msdn.com/ access/ -----Original Message----- From: [EMAIL PROTECTED] ps.com [mailto:ms_access@ yahoogrou ps.com] On Behalf Of luvmymelody Sent: Saturday, August 18, 2007 12:39 AM To: [EMAIL PROTECTED] ps.com Subject: [ms_access] Make visible a text box if a check box has a value as true on a form I tried to search the messages but I could not figure out what to search for. But I do have a question. I have a text box and an associated label on a form. I have a check box and the associated label on the same form. I want to have the text box and it's label appear only when the check box has a value as true. I have tried Google but to no avail either. does anyone have an idea how to do this? It should be easy, but I am struggling with it. What I have so far in code is below for the check box After Update event. I have tried to hide the text box but that does not work either. Thanks in advance. Jim Wagner Private Sub FromGoalsAppl_ AfterUpdate( ) If FromGoalsAppl. Value = True Then lblGoalNo.Visible = True GoalNo.Visible = True Else lblGoalNo.Visible = False GoalNo.Visible = False End If End Sub Yahoo! Groups Links ____________ _________ _________ _________ _________ _________ _ ________ Need a vacation? Get great deals to amazing places on Yahoo! Travel. http://travel. yahoo.com/ [Non-text portions of this message have been removed] Yahoo! Groups Links ____________ _________ _________ _________ _________ _________ _ ________ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos. yahoo.com/ carfinder/ [Non-text portions of this message have been removed] Yahoo! Groups Links ____________________________________________________________________________________ Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 [Non-text portions of this message have been removed]
