DGagnon819
Registered User.
- Local time
- Today, 15:26
- Joined
- Jun 17, 2006
- Messages
- 13
Hi All,
I'm posting this code for a AfterUpdate event hoping that a resident expert can give me some guidance. I never took VB in college and my skills are very crude to say the least.
On my form I have a Option Group and it is used to populate text boxes that are normally hidden. The values of these text boxes are then used by a ComboBox query to populate a list. In cases where the query does not return a value for the ComboBox I want a MsgBox to give the user instructions.
The Option Group seems to work just fine. It's only when the user selects a option where a null value exists that I'm having problems.
How can I get the MsgBox to correctly display?
I am attaching a picture of my form in case it helps. It will show the text boxes that I'm referring to. Respectfully,
D.Gagnon
I'm posting this code for a AfterUpdate event hoping that a resident expert can give me some guidance. I never took VB in college and my skills are very crude to say the least.
On my form I have a Option Group and it is used to populate text boxes that are normally hidden. The values of these text boxes are then used by a ComboBox query to populate a list. In cases where the query does not return a value for the ComboBox I want a MsgBox to give the user instructions.
The Option Group seems to work just fine. It's only when the user selects a option where a null value exists that I'm having problems.
How can I get the MsgBox to correctly display?
Code:
Private Sub TrainingType_AfterUpdate()
ClockNumber.Requery
If TrainingType.Value = 1 Then
JobCode.Value = Null
ProjectMandatoryCode.Value = "000ZZ"
ITTCode.Value = Null
DepartmentCode.Value = Null
TrainingEventName.Enabled = True
DateCompleted.Enabled = True
ElseIf TrainingType.Value = 2 Then
JobCode.Value = ClockNumber.Column(4)
ProjectMandatoryCode.Value = Null
ITTCode.Value = Null
DepartmentCode.Value = Null
TrainingEventName.Enabled = True
DateCompleted.Enabled = True
ElseIf TrainingType.Value = 3 Then
JobCode.Value = Null
ProjectMandatoryCode.Value = Null
DepartmentCode.Value = Null
ITTCode.Value = ITTPortalCode.Value
TrainingEventName.Enabled = True
DateCompleted.Enabled = True
ElseIf TrainingType.Value = 4 Then
JobCode.Value = Null
ProjectMandatoryCode.Value = Null
ITTCode.Value = Null
DepartmentCode.Value = CrossTrainingCode.Value
TrainingEventName.Enabled = True
DateCompleted.Enabled = True
ElseIf TrainingType.Value = 3 And IsNull(ITTPortalCode.Value) Or ITTPortalCode.Value = "" Then
JobCode.Value = Null
ProjectMandatoryCode.Value = Null
DepartmentCode.Value = Null
ITTCode.Value = ITTPortalCode.Value
TrainingEventName.Enabled = False
DateCompleted.Enabled = False
MsgBox "This Employee is not enrolled in ITT Portal Training." & _
vbCrLf & "You must enroll this employee in ITT Portal Training before events can be recorded." & _
vbCrLf & "Please use the Edit Employee Information form to enroll this employee in ITT Portal Training.", vbOKOnly
ElseIf TrainingType.Value = 4 And IsNull(CrossTrainingCode.Value) Or CrossTrainingCode.Value = "" Then
JobCode.Value = Null
ProjectMandatoryCode.Value = Null
ITTCode.Value = Null
DepartmentCode.Value = CrossTrainingCode.Value
TrainingEventName.Enabled = False
DateCompleted.Enabled = False
MsgBox "This Employee is not enrolled in Cross Training." & _
vbCrLf & "You must enroll this employee in Cross Training before events can be recorded." & _
vbCrLf & "Please use the Edit Employee Information form to enroll this employee in Cross Training.", vbOKOnly
End If
End Sub
I am attaching a picture of my form in case it helps. It will show the text boxes that I'm referring to. Respectfully,
D.Gagnon