473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Setting the value of a "checkbox"

sueb
379 256MB
I'm trying to set a checkbox field in my table based on what the user enters into another field. The following code does everything right (display the box as the user leaves the field, accept the click and disappear) except actually set the checkbox value. I don't get an error. Am I using the wrong value for "Yes"? Or what?

Private Sub Category_AfterUpdate()
On Error GoTo Err_Category_AfterUpdate

Dim myVAR As Byte

'Make the user specify whether this IUR needs Radiology's signature
If Me.Category.Value = "MRI" Then
mVAR = MsgBox("Does Radiology need to sign this?", vbYesNo + vbQuestion)
End If

'If so, set the tag; otherwise, do nothing
If myVAR = vbYes Then
Me.Rad_Sig.Value = -1
End If

Exit_Category_AfterUpdate:
Exit Sub

Err_Category_AfterUpdate:
MsgBox Err.Description
Resume Exit_Category_AfterUpdate

End Sub

Thanks!
May 20 '10 #1

✓ answered by TheSmileyCoder

Assumming the code is a direct copy/paste, its because you have a typo.
mVar should have been myVar
Expand|Select|Wrap|Line Numbers
  1. mVAR = MsgBox("Does Radiology need to sign this?", vbYesNo + vbQuestion)
Please read this article, it will save you ALOT of headaches!
Require Variable Declaration

Also when posting code, please remember to use the [code] . . . [/code] tags around your code.

2 1925
TheSmileyCoder
2,322 Expert Mod 2GB
Assumming the code is a direct copy/paste, its because you have a typo.
mVar should have been myVar
Expand|Select|Wrap|Line Numbers
  1. mVAR = MsgBox("Does Radiology need to sign this?", vbYesNo + vbQuestion)
Please read this article, it will save you ALOT of headaches!
Require Variable Declaration

Also when posting code, please remember to use the [code] . . . [/code] tags around your code.
May 20 '10 #2
sueb
379 256MB
Is my face red! I guess that's what I get for working too late too many days in a row.

Now it's perfect--thanks for catching that!
May 20 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: PhiSYS | last post by:
I want to know what's wrong with this code (I'm an amateur programmer). I'm trying to check if every field has a value or if checkboxes/radios have at least one item checked on each group (yes, you...
3
by: F. Da Costa | last post by:
Hi, Does the following indeed imply that this event is NOT called when an <input type="checkbox" is toggled? This would thus imply the usage of the onClick handler instead (assuming an action...
7
by: Don | last post by:
Via JavaScript within the client page containing the checkbox, I'm trying to capture the value of a checkbox to make a cookie out of it. But, all I get is the defined "ON" value, even when it is...
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
8
by: David Cameron | last post by:
I noticed that using an HTMLInputRadioButton and specifying a value to be an empty string (""), this is overridden by ASP.Net which set the value of the control to be the same as the ID of the...
0
by: Atara | last post by:
regarding the answers I got from the thread "Does each "New" needs a corresponding "Dispose" " (http://www.developersdex.com/vb/message.asp?p=&r=3582570&page=2) I have some questions: Till now,...
1
by: spolsky | last post by:
try the the following code with Opera 9.01 (Windows). when clicked slightly faster than normal clicking, the toggler checkbox and other checkboxes displays differently although event method works...
6
by: Deano | last post by:
Every once in a while I modify one particular form (could be anything from adding code to tweaking properties as far as I can see) and upon loading I get; "You can't assign a value to this...
3
by: blackrunner | last post by:
ERROR in my Query?! ERROR: Element GESCHLECHT is undefined in FORM. i think everything ok. Maby somebody can help me here Element GESCHLECHT is undefined in FORM. The error occurred...
4
faugustin
by: faugustin | last post by:
Hi, I have a problem. I have av form with textfields, textareas and a vector type fieldset of checkboxes. Everything but the checkboxes works fine, they result in "array" in the field in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.