473,480 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MSGBOX "FAILED"

lee123
556 Contributor
I have a form I have been working on and now I am almost done with it but there is just one thing I need to finish it that I can figure out. Well I have a questionnaire form with 50 questions and I want to have a msgbox display at the end of the questionnaire "failed" or "passed" when the users have finished the test. On this form I have text boxes with "correct' and "incorrect" and a text box for the total percentage of the correct. This is what I got in codes:

FOR THE "CORRECT" TEXTBOX THE CODE I HAVE PUT IN THE CONTROL SOURCE IS THIS,

Expand|Select|Wrap|Line Numbers
  1.  
  2. =IIf([CHECK4],1,0)+IIf([CHECK16],1,0)+IIf([check22],1,0)
  3. +IIf([CHECK46],1,0)+IIf([CHECK33],1,0)+IIf([CHECK58],1,0)
  4. +IIf([check73],1,0)+IIf([check103],1,0)+IIf([CHECK112],1,0)
  5. +IIf([CHECK150],1,0)+IIf([CHECK153],1,0)
  6.  
FOR THE "INCORRECT" I HAVE PRETTY MUCH THE SAME:
Expand|Select|Wrap|Line Numbers
  1. =IIf([CHECK6],1,0)+IIf([CHECK8],1,0)+IIf([CHECK14],1,0)
  2. +IIf([check12],1,0)+IIf([check20],1,0)+IIf([check28],1,0)
  3. +IIf([CHECK30],1,0)+IIf([CHECK37],1,0)+IIf([CHECK39],1,0)
  4. +IIf([CHECK41],1,0)+IIf([CHECK43],1,0)+IIf([CHECK56],1,0)
  5. +IIf([check65],1,0)+IIf([check67],1,0)+IIf([check71],1,0)
  6. +IIf([check105],1,0)+IIf([check108],1,0)+IIf([check101],1,0)
  7. +IIf([CHECK119],1,0)+IIf([CHECK148],1,0)
  8.  
FOR THE PERCENTAGE TEXTBOX THIS IS WHAT I HAVE:

=[CORRECT]/50


THIS IS JUST A LITTLE BIT OF THE CODES I HAVE NOT INCLUDING THE CHECKBOXES FOR THE ANSWERS WELL IF IT HELPS THIS IS ONE OF THE CHECKBOX CODE FOR THE INCORRECT:
Expand|Select|Wrap|Line Numbers
  1.       If Check12 = Check12 Then
  2.         Check12.Enabled = True
  3.         Check14.Enabled = False
  4.         Check16.Enabled = False
  5.         Check12.Locked = True
  6.     MsgBox "INCORRECT! THE CORRECT ANSWER IS 40 HRS"
  7. End If
Well this is just about what I have, but my question is how can I put a msgbox at the end of all of this that replies "failed" or "passed" or if the user gets so many questions wrong the message box would pop up with "failed"

This is probably too much right ?

LEE123
Jun 21 '07 #1
13 2338
tdw
206 New Member
I don't know if it's just my browser or what, but your post is very difficult to read.
could you please try reposting it without all the caps, and use the CODE tags around the code, as is explained in the little yellow box to the right of the typing window? Thanks
Jun 21 '07 #2
lee123
556 Contributor
ok i have a form i have been working on and now im almost done with it i have made a driving written test with 50 questions on it and the only thing i need is some kind of msgbox or a lable that pops up when the user gets done with the test. that displays either "failed" or "pass". i want to know if i can base this message on the incorrect textbox so if the user gets so many wrong the words "failed" would pop up. otherwise it would say "passed" the codes i have for the two textboxes is:

for the correct textbox i have this:
Expand|Select|Wrap|Line Numbers
  1. =iif(checkboxname,1,0)+iif(checkboxname,1,0)
there is alot of them.

the incorrect textbox i have:

Expand|Select|Wrap|Line Numbers
  1. =iif(checkboxname,1,0)+iif(checkboxname,1,0)

for the checkboxes the code behind it is:

Expand|Select|Wrap|Line Numbers
  1.  If ANSWER2 = ANSWER2 Then
  2.         ANSWER2.Enabled = True
  3.         ANSWER1.Enabled = False
  4.         ANSWER3.Enabled = False
  5.         ANSWER2.Locked = True
  6.     msgbox ("CORRECT!")
i don't know if i did this right but all of it works i just need to know how i can get the "failed" to pop up either in a msgbox or lbl if they get to many wrong.
can you help me.

ps i never knew how to make the tags work but now i know thanks.

lee123
Jun 21 '07 #3
tdw
206 New Member
ok i have a form i have been working on and now im almost done with it i have made a driving written test with 50 questions on it and the only thing i need is some kind of msgbox or a lable that pops up when the user gets done with the test. that displays either "failed" or "pass". i want to know if i can base this message on the incorrect textbox so if the user gets so many wrong the words "failed" would pop up. otherwise it would say "passed" the codes i have for the two textboxes is:

for the correct textbox i have this:
Expand|Select|Wrap|Line Numbers
  1. =iif(checkboxname,1,0)+iif(checkboxname,1,0)
there is alot of them.

the incorrect textbox i have:

Expand|Select|Wrap|Line Numbers
  1. =iif(checkboxname,1,0)+iif(checkboxname,1,0)

for the checkboxes the code behind it is:

Expand|Select|Wrap|Line Numbers
  1.  If ANSWER2 = ANSWER2 Then
  2.         ANSWER2.Enabled = True
  3.         ANSWER1.Enabled = False
  4.         ANSWER3.Enabled = False
  5.         ANSWER2.Locked = True
  6.     msgbox ("CORRECT!")
i don't know if i did this right but all of it works i just need to know how i can get the "failed" to pop up either in a msgbox or lbl if they get to many wrong.
can you help me.

ps i never knew how to make the tags work but now i know thanks.

lee123
Does your test form pop up a single question at a time? If so, once the next question comes up, is there anything remembering what they had answered on the last or previous questions, i.e. a new record in a table or something?
Jun 21 '07 #4
lee123
556 Contributor
to answer your question no the questions are on the form i used a label for the questions and however many check boxes i needed for the answers sorta like this:

(question):
how many hrs does a person under 17 have to complete before driving:


(answers)
Expand|Select|Wrap|Line Numbers
  1. checkbox 1
  2. checkbox 2
  3. checkbox 3
  4. checkbox 4
there all in a colunm going from top to bottom does that make any sense or
should i' ve done something different?

i guess to understand your question it would be like this: if you had a piece of paper and numbered question 1 question 2 and question 3 down the paper thats what it would look like and had the answers under the questions like a,b.or c
multiple choice.

lee123
Jun 21 '07 #5
lee123
556 Contributor
if the user picks a wrong answer the other answers are disabled so they can't change there mind but if the user picks the right answer the others disappear leaving only the right answer.
Jun 21 '07 #6
tdw
206 New Member
if the user picks a wrong answer the other answers are disabled so they can't change there mind but if the user picks the right answer the others disappear leaving only the right answer.
So all of the questions are on the form at the same time, like a full sheet of test questions? And once the student clicks on an answer, whether right or wrong, they cannot change their answer?
I'm learning Access as I go here, and I'm no expert yet. Since I have received so much help on this forum I like to try to help where I can. I have an idea though, see what you think (and what others on the forum think):

Maybe if you have a variable that counts up +1 every time a question is answered wrong, then every time it adds one to the variable it checks to see if it has reached the max limit of allowable wrong answers... then when it reaches it, it displays the FAILED LOSER!! (or something) message box and ends the test. If you're not sure how to do this and no one else has a better way, please let me know.
Jun 22 '07 #7
NeoPa
32,556 Recognized Expert Moderator MVP
Lee,
Your code for correct is ok, but your code for incorrect should be of the form :
Expand|Select|Wrap|Line Numbers
  1. =IIf(FirstCorrectCheckBox, 0, 1)+IIf(SecondCorrectCheckBox, 0, 1)+...
not
Expand|Select|Wrap|Line Numbers
  1. =IIf(FirstWrongCheckBox, 1, 0)+IIf(SecondWrongCheckBox, 1, 0)+...
NB The order of the 1s & the 0s.
Jun 22 '07 #8
lee123
556 Contributor
yea i'm not that good at variables i mean everytime i try it never works i see how it looks in my head but when i attempt it, it never works variables to me are tricky i've tried to do one and i don't get how they work so i don't know how to do this, i've tried the if ....then statement but nothing i wanted to try to use the iif with the incorrect code but nothing.

lee123
Jun 23 '07 #9
oldroboman
18 New Member
yea i'm not that good at variables i mean everytime i try it never works i see how it looks in my head but when i attempt it, it never works variables to me are tricky i've tried to do one and i don't get how they work so i don't know how to do this, i've tried the if ....then statement but nothing i wanted to try to use the iif with the incorrect code but nothing.

lee123
try something simple

dim counter as long
counter = 0

then after each question,
if answer = correct then counter = counter +1

and so on?
Jun 23 '07 #10
oldroboman
18 New Member
yea i'm not that good at variables i mean everytime i try it never works i see how it looks in my head but when i attempt it, it never works variables to me are tricky i've tried to do one and i don't get how they work so i don't know how to do this, i've tried the if ....then statement but nothing i wanted to try to use the iif with the incorrect code but nothing.

lee123
try something simple

Expand|Select|Wrap|Line Numbers
  1.       dim counter as long
  2.  
  3.       counter = 0
then after each question,

Expand|Select|Wrap|Line Numbers
  1.       if answer = incorrect then counter = counter +1
  2.       if counter = maxfail then 
  3.       msgbox("Better luck next time")
  4.       exit 
and so on?
Jun 23 '07 #11
oldroboman
18 New Member
Appoligies for the multi post, I accidently tabbed on the submit button, didn't realise you can't tab in this box!! sorry
Jun 23 '07 #12
NeoPa
32,556 Recognized Expert Moderator MVP
Apologies for the multi post, I accidently tabbed on the submit button, didn't realise you can't tab in this box!! sorry
No problem & thanks for explaining. I whipped out the second copy so it reads better now.

With reference to your solution, remember that the operator is not constrained in any way to answer the questions in order, nor, without some extra coding, to answer them only the once.
Jun 23 '07 #13
lee123
556 Contributor
thanks you guys for all your help i'll try what you said and hopfully it works if not i'll write back thanks,

lee123
Jun 23 '07 #14

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

Similar topics

1
1773
by: New MSSQL DBA | last post by:
hi all, have anyone else met with the following problem. we've got a SQL2000SP3a on a 2 active-active node clusters of W2K3, this cluster in using AD. I've found that whenever I use Enterprise...
2
7313
by: Ravi J | last post by:
I am trying to load Microsoft Word and create a document in ASP.NET (C#). But the call to application creation 'Word._Application app = new Word.ApplicationClass();' takes quit a bit of time, and...
1
4205
by: Jonas Auken | last post by:
hi, I have a repeater which dynamically loads another usercontrol throught databinding: OnClick: DataBind() rptProduct_ItemDataBound: ViewSmall _viewSmall = (ViewSmall)...
2
14926
by: Steve M | last post by:
A few users today received the message "The trust relationship between this workstation and the primary domain failed" on their web browser while using an ASP.NET web app. The problem went away...
5
3251
by: xieliwei | last post by:
I have a freshly installed openSuSe 10.2 with PHP4 from http://download.opensuse.org/repositories/home:/michal-m:/php4/openSUSE_10.2/ (openSuSe abandoned PHP4 since version 10, but I have customers...
2
6651
by: kilo | last post by:
Hey.. I need someone hwo can help me making my sql table.. I have no php skills. I have payed for a php program that shoud make dictation for people that have some problems reading danish.. with...
6
3214
by: haneeshkb | last post by:
I am getting this problem when I tried to build my borland c++ project. (compling and make doesn't giving any problem ) Fatal: Fatal: Assertion failed: !"How can you expand a vapor heap?" at...
0
2152
by: sa6113 | last post by:
I am using this code to connect to a windows machine using paramiko, I have installed sshd on the machine and it works properly: sock.connect((hostname, port)) t = paramiko.Transport(sock)...
0
3408
by: CoreyReynolds | last post by:
Hey all, I have a piece of code that dumps a bunch of data into a spreadsheet. Also rearranges it into a pivot table and then graphs the pivot table as well so my boss can get a clear view of the...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7048
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,...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4783
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4485
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2997
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.