472,104 Members | 1,088 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,104 software developers and data experts.

Populate text box with option value

26
Hi guys,

I have a problem with an option group and a two corresponding text boxes. When the user chooses an option value i want the text boxes to populate with text dependent on the choice made.

I have written an AfterUpdate procedure on the frame to try and assign the text to the value of the text box, but for some reason it does nothing...

Here is the code:

Private Sub Frame0_AfterUpdate()
If Frame0.Value = 1 Then
Typeofsharpinjury.Value = "Intact skin visibly contaminated with blood or any body substance"
Risklevel.Value = "Non-parenteral exposure"
ElseIf Frame0.Value = 2 Then
Typeofsharpinjury.Value = "Intradermal (superficial) injury with a needle considered NOT to be contaminated with blood or body substance"
Risklevel.Value = "Doubtful exposure (Low-risk)"
ElseIf Frame0.Value = 3 Then
Typeofsharpinjury.Value = "Superficial wound not associated with visible bleeding, caused by an instrument cosidered NOT to be contaminated with blood or a body substance"
Risklevel.Value = "Doubtful exposure (Low-risk)"
ElseIf Frame0.Value = 4 Then
Typeofsharpinjury.Value = "Prior wound or skin lesion contaminated with a body substance other than blood e.g. urine"
Risklevel.Value = "Doubtful exposure (Low risk)"
ElseIf Frame0.Value = 5 Then
Typeofsharpinjury.Value = "Mucous membrane or conjunctival contact with a body fluid other than blood"
Risklevel.Value = "Doubtful exposure (Low-risk)"
ElseIf Frame0.Value = 6 Then
Typeofsharpinjury.Value = "Intradermal (superficial) injury with a needle contaminated with blood or body subtance"
Risklevel.Value = "Possible exposure (Medium-risk)"
ElseIf Frame0.Value = 7 Then
Typeofsharpinjury.Value = "A wound NOT associated with visible bleeding, produced by an instrument contaminated with blood or body substance"
Risklevel.Value = "Possible exposure (Medium-risk)"
ElseIf Frame0.Value = 8 Then
Typeofsharpinjury.Value = "Prior wound or skin lesion contaminated with blood or body substance"
Risklevel.Value = "Possible exposure (Medium-risk)"
ElseIf Frame0.Value = 9 Then
Typeofsharpinjury.Value = "Mucous membrane or conjunctival contact with blood or body substance"
Risklevel.Value = "Possible exposure (Medium-risk)"
ElseIf Frame0.Value = 10 Then
Typeofsharpinjury.Value = "Skin penetrating injury with a needle contaminated with blood or body substance"
Risklevel.Value = "Definite exposure (High-risk)"
ElseIf Frame0.Value = 11 Then
Typeofsharpinjury.Value = "Injection of blood/body substance <1ml"
Risklevel.Value = "Definite exposure (High-risk)"
ElseIf Frame0.Value = 12 Then
Typeofsharpinjury.Value = "Laceration or similar wound which caused bleeding, and is produced by an instrument that is visibly contaminated with blood or body substance"
Risklevel.Value = "Definite exposure (High-risk)"
ElseIf Frame0.Value = 13 Then
Typeofsharpinjury.Value = "In laboratory settings, any direct inoculation with HIV tissue or material likely to contain HIV, HBV or HCV not included above."
Risklevel.Value = "Definite exposure (High-risk)"
ElseIf Frame0.Value = 14 Then
Typeofsharpinjury.Value = "Transfusion of blood"
Risklevel.Value = "Massive exposure (High-risk)"
ElseIf Frame0.Value = 15 Then
Typeofsharpinjury.Value = "Injection of large amount of blood/body substance >1ml"
Risklevel.Value = "Massive exposure (High-risk)"
ElseIf Frame0.Value = 16 Then
Typeofsharpinjury.Value = "Parenteral exposure to laboratory specimens containing high titre of virus"
Risklevel.Value = "Massive exposure (High-risk)"
End If
End Sub

Thanks in advance guys.

Chris
Sep 13 '07 #1
1 2229
MMcCarthy
14,534 Expert Mod 8TB
Try this ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Frame0_AfterUpdate()
  2.  
  3.    SELECT CASE Frame0
  4.  
  5.    Case 1
  6.       Me.Typeofsharpinjury.Value = "Intact skin visibly contaminated with blood or any body substance"
  7.       Me.Risklevel.Value = "Non-parenteral exposure"
  8.    Case 2
  9.       Me.Typeofsharpinjury.Value = "Intradermal (superficial) injury with a needle considered NOT to be contaminated with blood or body substance"
  10.       Me.Risklevel.Value = "Doubtful exposure (Low-risk)"
  11.    Case 3
  12.       Me.Typeofsharpinjury.Value = "Superficial wound not associated with visible bleeding, caused by an instrument cosidered NOT to be contaminated with blood or a body substance"
  13.       Me.Risklevel.Value = "Doubtful exposure (Low-risk)"
  14.    Case 4
  15.       Me.Typeofsharpinjury.Value = "Prior wound or skin lesion contaminated with a body substance other than blood e.g. urine"
  16.       Me.Risklevel.Value = "Doubtful exposure (Low risk)"
  17.    Case  5
  18.       Me.Typeofsharpinjury.Value = "Mucous membrane or conjunctival contact with a body fluid other than blood"
  19.       Me.Risklevel.Value = "Doubtful exposure (Low-risk)"
  20.    Case  6
  21.       Me.Typeofsharpinjury.Value = "Intradermal (superficial) injury with a needle contaminated with blood or body subtance"
  22.       Me.Risklevel.Value = "Possible exposure (Medium-risk)"
  23.    Case  = 7
  24.       Me.Typeofsharpinjury.Value = "A wound NOT associated with visible bleeding, produced by an instrument contaminated with blood or body substance"
  25.       Me.Risklevel.Value = "Possible exposure (Medium-risk)"
  26.    Case  = 8
  27.       Me.Typeofsharpinjury.Value = "Prior wound or skin lesion contaminated with blood or body substance"
  28.       Me.Risklevel.Value = "Possible exposure (Medium-risk)"
  29.    Case  = 9
  30.       Me.Typeofsharpinjury.Value = "Mucous membrane or conjunctival contact with blood or body substance"
  31.       Me.Risklevel.Value = "Possible exposure (Medium-risk)"
  32.    Case  = 10
  33.       Me.Typeofsharpinjury.Value = "Skin penetrating injury with a needle contaminated with blood or body substance"
  34.       Me.Risklevel.Value = "Definite exposure (High-risk)"
  35.    Case  = 11
  36.       Me.Typeofsharpinjury.Value = "Injection of blood/body substance <1ml"
  37.       Me.Risklevel.Value = "Definite exposure (High-risk)"
  38.    Case  = 12
  39.       Me.Typeofsharpinjury.Value = "Laceration or similar wound which caused bleeding, and is produced by an instrument that is visibly contaminated with blood or body substance"
  40.       Me.Risklevel.Value = "Definite exposure (High-risk)"
  41.    Case  = 13
  42.       Me.Typeofsharpinjury.Value = "In laboratory settings, any direct inoculation with HIV tissue or material likely to contain HIV, HBV or HCV not included above."
  43.       Me.Risklevel.Value = "Definite exposure (High-risk)"
  44.    Case  = 14
  45.       Me.Typeofsharpinjury.Value = "Transfusion of blood"
  46.       Me.Risklevel.Value = "Massive exposure (High-risk)"
  47.    Case  = 15
  48.       Me.Typeofsharpinjury.Value = "Injection of large amount of blood/body substance >1ml"
  49.       Me.Risklevel.Value = "Massive exposure (High-risk)"
  50.    Case  = 16
  51.       Me.Typeofsharpinjury.Value = "Parenteral exposure to laboratory specimens containing high titre of virus"
  52.       Me.Risklevel.Value = "Massive exposure (High-risk)"
  53.    END SELECT
  54.  
  55. End Sub
  56.  
Also double check the names of the textboxes. You can do this in properties under the other tab. Make sure that the textbox names are what you think they are.

Mary
Sep 13 '07 #2

Post your reply

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

Similar topics

4 posts views Thread by Frank Py | last post: by
2 posts views Thread by C. David Rossen | last post: by
1 post views Thread by Greg Scharlemann | last post: by
20 posts views Thread by Dannyboyo | last post: by
2 posts views Thread by James Goodman | last post: by
reply views Thread by leo001 | last post: by

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.