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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Box question 3

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I have on a form 6 check boxes in an option group. I want to force the person using the form to check one of those boxes before changing the status of the record. I was going to try and use the If IsNull(fieldname) but then i relized that will force them to check all the boxes. how can i make the form force the person to check one check box??

Thanks DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
Check Access help for the OptionValue property. You should be able to interrogate this value. If it is 0 (zero), nothing has been selected.....
 
Try this:

IF me!MyCheckBox1.Value +
me!MyCheckBox2.Value +
me!MyCheckBox3.Value +
me!MyCheckBox4.Value +
me!MyCheckBox5.Value +
me!MyCheckBox6.Value = 0 THEN

Display error message here...

EndIf

Hope that helps... Terry M. Hoey
 
when trying the above code I get a compile error...it looks like it asking for a then after the +...

DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
Try putting the code all on one line. Or, I believe if you put a space and an under bar (" _") at the end of each line, it will know that the line continues... Terry M. Hoey
 
Hi!

Another option is to use the default value of the option group. Set the default value to the option value of the check box which is most likely to be used and, when the form is opened, that check box will automatically be selected.

hth Jeff Bridgham
bridgham@purdue.edu
 
your right...i didnt even think about it being all one line of code..anyway now its telling me that the expersion has no value...

there is no default value for the check boxes..each check box has a different option value..the option value is connected to a status, so what ever check box is checked it will put that number in the field..

any ideas??

DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
The Option Group will contain a numeric value if an item within it has been selected, otherwise it's null. If your option group is called optGroup, do something like this:
Code:
If IsNull([optGroup]) Then
 Display error message here...
 ......
End If

 
Hi!

I know that there is no default value for the check boxes. I recommended setting the default value of the option group. The default value of the option group determines which check box starts out checked. And it makes sure that there is a value assigned to the option group.

hth Jeff Bridgham
bridgham@purdue.edu
 
I thought the original intent was to not have a default, check to see if the user checked a box, and if not, require them to do so. Other than setting a default value of something other than one of its items, how is setting a default value for the group going to ensure that??
 
Exactly what I wanted Cosmo..That is correct I donot want a value for the check boxes...Thanks for your help it worked perfect..

DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top