UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Check Box On Continuous Form    
 
   
sugarcane
post Sep 28 2005, 03:23 PM
Post #1

UtterAccess Ruler
Posts: 1,256
From: Canada



I have a continuous form with checkboxes that allow me to check only one at a time - this is fine. I'm just not sure how to enable only one to be checked at a time.

Thanks!
Go to the top of the page
 
+
schroep
post Sep 28 2005, 03:55 PM
Post #2

UtterAccess VIP
Posts: 5,200
From: Denver, Colorado [USA]



Your checkboxes need to be inside an option group.
Go to the top of the page
 
+
sugarcane
post Sep 28 2005, 04:26 PM
Post #3

UtterAccess Ruler
Posts: 1,256
From: Canada



Sorry - I gave you wrong info. it's actually only one check box on the continuous form.

There are 4 choices and the user have to check the correct one....
Go to the top of the page
 
+
schroep
post Sep 28 2005, 04:32 PM
Post #4

UtterAccess VIP
Posts: 5,200
From: Denver, Colorado [USA]



I don't understand. If there are four choices and the user is selecting one, then there are four checkboxes, right?

Are you saying there are four RECORDS displayed using a continuous form? And each RECORD has one checkbox, corresponding to a Yes/No field in the table? And you want to set the other three RECORDS to "no" when one of the RECORDS is checked to "yes"?

If that's the case, you want to run an UPDATE query in the AfterUpdate event of the checkbox field to set all the other RECORDS to no.

But I have to say, this seems like strange design. Why are you using a continuous form for this?
Go to the top of the page
 
+
sugarcane
post Sep 28 2005, 04:58 PM
Post #5

UtterAccess Ruler
Posts: 1,256
From: Canada



What you explained is exactly how I have it set-up.

I'm creating a quiz database where I can enter a hugh amount and be able to go in and tick a few quizzes that I want to print (rather than retying/rearranging them in MS Word). The reason why I have the check box is to remember which is the correct answer.

It's not crucial that I have this done because I will be the only one using it - but thought it would be good to have in order to prevent checking two.

Attached is a pic so you can see what I'm doing....

Thanks for your help!
Attached File(s)
Attached File  QuizForm.gif ( 230.91K ) Number of downloads: 7
 
Go to the top of the page
 
+
schroep
post Sep 28 2005, 05:10 PM
Post #6

UtterAccess VIP
Posts: 5,200
From: Denver, Colorado [USA]



Open your continuous form.

Create an AFTERUPDATE event for the CorrectAns field.

CODE
CurrentProject.Connection.Execute "UPDATE tablename SET fieldname=0 WHERE quesidfieldname=" & Me.quesidcontrolname & " And answeridfieldname<>" & Me.answeridcontrolname

Me.Requery

tablename = the name of the table you are updating (the answers table)
fieldname = the name of the yes/no field in that table
quesidfieldname = the name of the field in the table that contains the QuestionID
questidcontrolname = the name of the (hidden?) control on your form that contains the current QuestionID
answeridfieldname = the ID field that uniquely identifies this answer (for this question) in your table
answercontrolname = the control on your form (likely hidden) that contains the ID of the current answer record
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 01:37 PM