Hello all,
I'm working on setting up a continuous form to display a summary of different insurance claims for the past week. I want to have a text box that would change based on whether certain checkboxes where checked or certain drop-down menu items picked.
I got it to work for the first record in my form, but for some reason the same value is then assigned to the other records in the form. So I am guessing that Access is running my code once and then assigning the same word to each label. So how do I make sure that it runs the code for each record and changes the text box on each record accordingly? I tried changing the code around without the variable EventID and such, but I have had no luck. Any ideas?
Code Pasted Below:
Public Sub Form_AfterUpdate()
Dim EventID As String
If [txtWCType] = "Nurse Case Mgt." Then
EventID = "Comp."
ElseIf [txtWCType] = "Med Only" Then
EventID = "Med"
ElseIf [txtWCType] = "Notice Only" Then
EventID = "Notice"
ElseIf [txtGLType] = "Property Damage" Then
EventID = "PD"
ElseIf [txtGLType] = "Bodily Injury" Then
EventID = "BI"
ElseIf [chkPETheft].Value = True Then
EventID = "Theft"
ElseIf [chkPEDamage].Value = True Then
EventID = "Damage"
ElseIf [chkAUCollision].Value = True Then
If [chkAULiability].Value = True Then
EventID = "Col./Liab."
Else
EventID = "Col."
End If
ElseIf [chkAULiability].Value = True Then
EventID = "Liab."
ElseIf [chkAUComprehensive].Value = True Then
EventID = "Comp."
End If
[lblClaim].Caption = EventID
End Sub
I'm working on setting up a continuous form to display a summary of different insurance claims for the past week. I want to have a text box that would change based on whether certain checkboxes where checked or certain drop-down menu items picked.
I got it to work for the first record in my form, but for some reason the same value is then assigned to the other records in the form. So I am guessing that Access is running my code once and then assigning the same word to each label. So how do I make sure that it runs the code for each record and changes the text box on each record accordingly? I tried changing the code around without the variable EventID and such, but I have had no luck. Any ideas?
Code Pasted Below:
Public Sub Form_AfterUpdate()
Dim EventID As String
If [txtWCType] = "Nurse Case Mgt." Then
EventID = "Comp."
ElseIf [txtWCType] = "Med Only" Then
EventID = "Med"
ElseIf [txtWCType] = "Notice Only" Then
EventID = "Notice"
ElseIf [txtGLType] = "Property Damage" Then
EventID = "PD"
ElseIf [txtGLType] = "Bodily Injury" Then
EventID = "BI"
ElseIf [chkPETheft].Value = True Then
EventID = "Theft"
ElseIf [chkPEDamage].Value = True Then
EventID = "Damage"
ElseIf [chkAUCollision].Value = True Then
If [chkAULiability].Value = True Then
EventID = "Col./Liab."
Else
EventID = "Col."
End If
ElseIf [chkAULiability].Value = True Then
EventID = "Liab."
ElseIf [chkAUComprehensive].Value = True Then
EventID = "Comp."
End If
[lblClaim].Caption = EventID
End Sub