473,404 Members | 2,187 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,404 software developers and data experts.

Validating Check Boxes in relation to Option Group input

Hey,

I am trying to do a fairly simple validation, but it just won't work! I have 14 module options (split into 2 categories-semester 1 and semester 2) and I am attempting to ensure that one option per category is checked in relation to chosen course title. I have tried all sorts of IF and Case statements- i don't get any error message but it just doesn't work the way I want it to. With the code the way it is at the moment, Valid8 always appears to be false. Here's my code:
Expand|Select|Wrap|Line Numbers
  1. Core1 = Sem1Op7 + Sem2Op7
  2. Core2 = Sem1Op5 + Sem2Op6
  3. Core3 = Sem1Op6 + Sem2Op5
  4. Course = DLookup("[CourseTitle]", "Student", "[CourseTitle] = Forms!Student!Frame10")
  5.  
  6.  
  7. If (Core1 = -2) And (Course = "1") Then
  8.     Valid8 = True
  9. ElseIf (Core2 = -2) And (Course = "2") Then
  10.     Valid9 = True
  11. ElseIf (Core3 = -2) And (Course = "3") Then
  12.     Valid10 = True
  13. End If
I would like a different msgbox to come up for each valid 8/9/10

Any help would be very much appreciated-I bet it is a silly mistake

Thanks
Sophie
Jan 7 '10 #1
3 1895
NeoPa
32,556 Expert Mod 16PB
Sophie, you haven't really explained what the controls are on your form that you're working with.

Furthermore, if you choose to work with generic, Access assigned, names (EG. Frame10) then no-one will have much idea what it is unless you explain it separately. It's generally easier to give things meaningful names though.

I'm thinking you're probably looking for Radio Buttons in an Option Group, but though you refer to the OG in the title, there is nothing to indicate what you are working with here.

Lastly, the context of your code (procedure specification etc) is often more important (and tells a reader more) than the code itself. It's rarely a good idea to leave it out.

We can at least determine that you have a table named [Student] and a form named [Student] which has a frame (called Frame10). The other controls on the form are named (which is good) but the names (and explanation) omits the types of any of these controls (conventionally a name would have a 3-letter prefix indicating the type - txtBob for TextBox; lstGerry for a ListBox; chkMarkus for a CheckBos etc).
Jan 7 '10 #2
Sorry I didn't explain myself very clearly, I was trying to find the best way to explain myself concisely, but it backfired. so...
I have a form named [Student], on this form I have an option group which captures the [Course Title] data (this is what is named frame10). I then have 7 option buttons which capture Semester 1 module options data, and a further 7 option buttons which capture Semester 2 module options data. These are named [Sem1Op1], [Sem1Op2] and so on.

My aim with the code:
When the student chooses their [Course Title] they must also have chosen two specific module options eg. Sem1Op5 and Sem2Op6

I hope this makes the scenario clearer

Thanks for your patience
Jan 8 '10 #3
NeoPa
32,556 Expert Mod 16PB
Sophie, I'm afraid I looked at your latest post earlier and it seemed to be a much better explanation. I decided I neeeded to put it aside until I had a little time to get to grips with it though. Now I have the time I find that it isn't as clear as I'd thought it was. Let me comment on some of the places where I get confused and I'm sure we can get to the heart of the matter.
  • I can't imagine what a field [CourseTitle] type might be if it's not text. It doesn't seem to be text as you are trying to filter on it without any quotes (See Quotes (') and Double-Quotes (") - Where and When to use them). You also seem to feel the value is contained within an OptionBox or Frame control. This type of control can only contain numeric values which reflect which of the (typically) RadioButton controls is selected.
  • Your explanation mentions 7 options per semester, but your code only has three each.
  • The code that references the options uses arithmetic on bBoolean values. This is fine if done with full understanding, yet can be complicated for those who don't appreciate it well. From my position, I have to question whether your grasp is strong enough for me to rely on what the code says, particularly as it doesn't seem to match your explanation very well. That leaves me struggling to understand where you want me to take you.
  • The context, as mentioned before, is still missing. With a perfect explanation this is not necessary, but in this situation it may provide clues to me as to what you are actually trying to communicate. If you look back to the first point I make for instance, the Dim statement for the variable Course would have given me a better understanding of what you were thinking when you wrote this code.
Sorry for the delay in responding, I honestly was convinced before I looked into it that it would be straightforward when I got around to it. Unfortunately it wasn't, which was my bad call.
Jan 10 '10 #4

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

Similar topics

3
by: Mark | last post by:
Hi, Im trying to validate a form, all the validating works apart from one field. This particular field must consist of the first 2 characters as letters, & the following 5 as numbers. And if it...
10
by: Samir | last post by:
Say I have 4 forms, all four have different numbers of text boxes. is there a script that I can use to check to make sure everything on the form is not blank?
1
by: sman | last post by:
Hi, I recently read this article on About.com on how to create required fields for a form: http://javascript.about.com/library/scripts/blformvalidate.htm Everything works great except that there...
5
by: callmebill | last post by:
I'm relatively new to javascript, and I'm trying to decide whether the following (and if so, clues on how to do it): I'd like to create two HTML multiple-select boxes. The first would be a list...
0
by: Robert | last post by:
Stephen, I think I figured out the problem. I was able to get Check Boxes and Option Buttons to work on my form by TURNING OFF RECORD SELECTORS on the form. Not sure why this would make a...
1
by: mfaisalwarraich | last post by:
Hi Experts Around the World. I made a table called mainTable, two fields of this table one is SNO and other is Relation are text data types. SNO and Relation can be any string values. Relation stores...
2
by: FlashCreations | last post by:
Hello, I am trying to use javascript to validate a form that has three select inputs. Here is the form: <form name="select" action="main.php" method="post" onsubmit="return ValidateSelect(this)"> ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.