473,769 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ 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 2376
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,573 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

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

Similar topics

1
1802
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 Manager on my local computer to register the above instance, it will constantly produce "Failed login for <Domain>\<DomainUser>" errors in the Windows Security Log of the database server machine. There's no failed login in the SQL error log and...
2
7338
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 eventually "Server Execution Failed" page appears. "Exception Details: System.Runtime.InteropServices.COMException: Server execution failed ... " The same call inside a WIndows Form succeeds. But for some reason, in ASP.NET it doesn't. Quick...
1
4246
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) LoadControl("ViewSmall.ascx");
2
14945
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 but has anyone seen this before on a error page? I think it occured when users were reporting general slow web performance. I've seen it while users try to log into an NT domain from their desktops but not while using a web browser. Users can log...
5
3275
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 who need php4 support) The version strings are as follows: # uname -a Linux server2 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC 2006 i686 athlon i386 GNU/Linux
2
6672
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 sound and text.. When I'm making the dictation with PHP I'm getting an error like this.: Query failed (SELECT word FROM repository): Table 'test_dig_dk.repository' doesn't exist the first one of the php, that I soud use for makeing the text is.. ...
6
3244
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 "LMEM.C" Can anybody help me on this ?
0
2189
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) event = threading.Event() t.start_client(event) event.wait() if not t.is_active(): print 'SSH negotiation failed.'
0
3434
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 data. This question is two part. One, I seem to be getting the title error at the starting line stating: oSheet.Range(rng).Select With Selection shp.Left = .Left shp.Top = .Top
0
9583
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10210
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9860
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5297
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.