Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Question

Status
Not open for further replies.

Dynapen

Programmer
Apr 20, 2000
245
US
I need to write the VB code to have a Check box change some fields. I need to make is so that when i have a check box value, off a Yes/No field, that equals No, it clears the contents of 4 different fields on a form.<br>I should be able to do it with a IF/then statment, but it keeps giving me error messages when i try to debug it. <br><br>I am a novice at VB but i am tyring to learn.....Help please<br><br>Thank in advnace...<br><br>Dynapen
 
use the after update event of the check box<br><br>if mycheckbox=false then<br>&nbsp;field1 = null<br>&nbsp;field2=null<br>&nbsp;field3=null<br>&nbsp;field4=null<br>end if<br><br>
 
Cornerstone's solution should work fine, but if it doesn't try to make the four fields empty strings instead of null.<br><br>If mycheckbox = False Then<br>&nbsp;&nbsp;&nbsp;field1 = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;field2 = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;field3 = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;field4 = &quot;&quot;<br>End If
 
Unfortunately i have found that it only partly worked.<br><br>If Check17 = False then<br>Section = &quot;FILES&quot;<br>Reason = Null<br>Phone = Null<br>POC = Null<br>End If<br><br><br>This is the string that i am using. THe problem is that only the field &quot;Reason&quot; is updating when i run the code. That one field works fine, but the rest of them don't change at all. I checked the field names about 40 times, and can't figure out what is going on.....Does anyone have any idea what is causing this?<br><br>
 
If you are not using me! syntax, access may think &quot;section&quot; or &quot;phone&quot;, etc, are undeclared variables...I'm not sure if that's it but a good start would be to use the qualified syntax and see if the problem is still there..<br>--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top