home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2889
Discussions: 188,379, Posts: 2,243,461, Members: 232,607
Old August 4th, 2002, 12:11 AM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Jun 2002
Location: Papua New Guinea
Posts: 12
Exclamation
Combo Boxes (Urgent Help required)

I'm still working on a database for my school library.
There are two combo boxes - Grade, Course.
The combo box Grade allows the operator to pick grades from 8 - 12.
The combo box Course allows the operator to pick four courses: A, B, C and D

All the grades (8,9,10,11,12) can do A or B
Only grade 10 can do C
Only grades 11 and 12 can do D

On my form when the operator chooses grade 8 from Grade, I want the combo box Course to only give the operator the options A and B NOT C or D.
Can someone pllllllllllllllllleeeeeeeeeasse help me...
shahzadsk

shahzadsk is offline   Reply With Quote
Old August 4th, 2002, 02:27 AM     #2 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,019
hmmm
well.. when you change the value in a combo box it calls an event

comboxbox_change() event
You could put code in there that says

Case 'A'
Case 'B'
combograde.add "A"
combograde.add "B"
Case 'c'
combograde.add C

well you get the point

not the greatest code in the world IMO but it'd work

vass0922 is online now   Reply With Quote
Old August 4th, 2002, 04:32 AM     #3 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Alberta, Canada
Posts: 563
gettin late for me to do much right now, but maybe this will help somehow...

to delete an option, set it to null:
document.forms[0].name_of_select_box.options[index_of_option_to_delete] = null;

to add an option (adds it to the end of drpdown box):
document.forms[0].name_of_select_box.options[document.forms[0].name_of_select_box.options.length] = new Option("text", "value");

came from here basically...

ciao!

edit: can also use document.forms['form_name'] instead of document.forms[0], actually, I'd recommend it since it's safer, unless it's guaranteed to be only one form on the page...


Last edited by ^hyd^ : August 4th, 2002 at 04:34 AM.
^hyd^ is offline   Reply With Quote
Old August 4th, 2002, 09:07 AM     #4 (permalink)
Junior Member
 
Join Date: Jun 2002
Location: Papua New Guinea
Posts: 12
I'll try them out.
Thanks..
shahzadsk is offline   Reply With Quote
Old August 4th, 2002, 11:43 AM     #5 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,019
hmm you never did specify what language you're working in
vass0922 is online now   Reply With Quote
Old August 5th, 2002, 12:29 AM     #6 (permalink)
Junior Member
 
Join Date: Jun 2002
Location: Papua New Guinea
Posts: 12
Sorry.. VB in Access 2000
shahzadsk is offline   Reply With Quote
Old August 5th, 2002, 12:33 AM     #7 (permalink)
Junior Member
 
Join Date: Jun 2002
Location: Papua New Guinea
Posts: 12
Private Sub Grade_Click()
10: Course.AddItem "ACT"
Course.AddItem "IB"
Course.AddItem "IGCSE"
Course.AddItem "PNG"

Select Case (Grade)
Case "8"
Course.RemoveItem "IB"
Course.RemoveItem "IGCSE"
GoTo 10
Case "9"
Course.RemoveItem "IB"
Course.RemoveItem "IGCSE"
GoTo 10
Case "10"
Course.RemoveItem "IB"
GoTo 10
Case "11"
Course.RemoveItem "IGCSE"
GoTo 10
Case "12"
Course.RemoveItem "IGCSE"
GoTo 10
End Select
End Sub

I used this but since it's a continuous loop it uses 99% of CPU power
shahzadsk is offline   Reply With Quote
Old August 5th, 2002, 12:34 AM     #8 (permalink)
Junior Member
 
Join Date: Jun 2002
Location: Papua New Guinea
Posts: 12
So I tried this..
It works, but if I click on grade 10 and Igcse and then i click back on grade 8, it will accept grade 8 and IGCSE..which should not be accepted.. I want to run the code every second..

Private Sub Course_Click()
If Grade = "8" And Course = "IB" Then
GoTo 1
Else: GoTo 2
2: If Grade = "8" And Course = "IGCSE" Then
GoTo 1
Else: GoTo 3
3: If Grade = "9" And Course = "IB" Then
GoTo 1
Else: GoTo 4
4: If Grade = "9" And Course = "IGCSE" Then
GoTo 1
Else: GoTo 5
5: If Grade = "10" And Course = "IB" Then
MsgBox "Please select either ACT, IGCSE or PNG from the dropdown list."
Course = ""
GoTo 100
Else: GoTo 6
6: If Grade = "11" And Course = "IGCSE" Then
MsgBox "Please select ACT, IB or PNG from the dropdown list."
Course = ""
GoTo 100
Else: GoTo 7
7: If Grade = "12" And Course = "IGCSE" Then
MsgBox "Please select ACT, IB or PNG from the dropdown list."
Course = ""
GoTo 100
Else: GoTo 100
End If
End If
End If
End If
End If
End If
End If
1: MsgBox "Please choose either ACT or PNG from the dropdown list."
Course = ""
100: End Sub
shahzadsk is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2885)
The United States Debt (20)
Looks like Burris will get his Sena.. (8)
I think I just killed my computer w.. (24)
Upgrading RAM (5)
Folderchat Weekday thread (439)
Antec 300 bulk purchase? (11)
Worth the upgrade?? (14)
Help with an Ati Radeon HD 4850 512.. (25)
Recent Discussions
Best digital camera for under 2.. (14)
Help with an Ati Radeon HD 4850.. (25)
Install Problem for Windows Def.. (0)
New Build ( Finally ) (1)
dual monitors wont boot (0)
Folderchat Weekday thread (439)
MSN Hotmail Down??? (7)
Laptop waking up itself (0)
CPU wont boot (3)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 08:38 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28