PDA

View Full Version : Solved: Form Validation help



majaro
01-13-2008, 07:12 AM
Can anyone tell me why this isn't working. This is cross posted at AccessWorld BTW. Usually don't cross post but I'm under pressure on this. Thanks in advance for any help. :banghead:

Private Sub chkCompleted_BeforeUpdate(Cancel As Integer)
Dim strMessage As String
If chkCompleted = False Then
lblDateCompleted.Visible = False
txtDateCompleted.Visible = False
Else
lblDateCompleted.Visible = True
txtDateCompleted.Visible = True
End If
If ((IsNull(Me.DateEntered) Or Me.DateEntered = "")) Then
strMessage = strMessage & "You must fill in Date Entered" & vbCrLf
Me.DateEntered.SetFocus
Cancel = True
Else
If ((IsNull(Me.DataEnteredBy) Or Me.DataEnteredBy = "")) Then
strMessage = strMessage & "You must fill in Data Entered By" & vbCrLf
Me.DataEnteredBy.SetFocus
Cancel = True
End If
If ((IsNull(Me.PSUDept) Or Me.PSUDept = "")) Then
strMessage = strMessage & "You must fill in PSU Department" & vbCrLf
Me.PSUDept.SetFocus
Cancel = True
End If
If ((IsNull(Me.DateEntered) Or Me.DateEntered = "")) Then
strMessage = strMessage & "You must fill in Date Entered" & vbCrLf
Me.DateEntered.SetFocus
Cancel = True
End If
If ((IsNull(Me.FormCompBy) Or Me.FormCompBy = "")) Then
strMessage = strMessage & "You must fill in Form Completed By" & vbCrLf
Me.FormCompBy.SetFocus
Cancel = True
End If
If ((IsNull(Me.ProjTitle) Or Me.ProjTitle = "")) Then
strMessage = strMessage & "You must fill in Project Title" & vbCrLf
Me.ProjTitle.SetFocus
Cancel = True
End If
If ((IsNull(Me.ProjDesc) Or Me.ProjDesc = "")) Then
strMessage = strMessage & "You must fill in Project Description" & vbCrLf
Me.ProjDesc.SetFocus
Cancel = True
End If
If ((IsNull(Me.StartDate) Or Me.StartDate = "")) Then
strMessage = strMessage & "You must fill in Start Date" & vbCrLf
Me.StartDate.SetFocus
Cancel = True
End If
If ((IsNull(Me.ProjectedEndDate) Or Me.ProjectedEndDate = "")) Then
strMessage = strMessage & "You must fill in Projected End Date" & vbCrLf
Me.ProjectedEndDate.SetFocus
Cancel = True
End If
If ((IsNull(Me.DateEntered) Or Me.DateEntered = "")) Then
strMessage = strMessage & "You must fill in Date Entered" & vbCrLf
Me.DateEntered.SetFocus
Cancel = True
End If
If ((IsNull(Me.LevelOfEffort) Or Me.LevelOfEffort = "")) Then
strMessage = strMessage & "You must fill in Level Of Effort" & vbCrLf
Me.LevelOfEffort.SetFocus
Cancel = True
End If
If ((IsNull(Me.OtherDivisionalGoal) Or Me.OtherDivisionalGoal = "")) Then
strMessage = strMessage & "You must fill in Other Divisional Goal" & vbCrLf
Me.OtherDivisionalGoal.SetFocus
Cancel = True
End If
If ((IsNull(Me.Collaborators) Or Me.Collaborators = "")) Then
strMessage = strMessage & "You must fill in Collaborators" & vbCrLf
Me.Collaborators.SetFocus
Cancel = True
End If
If ((IsNull(Me.PrimaryClient) Or Me.PrimaryClient = "")) Then
strMessage = strMessage & "You must fill in Primary Client" & vbCrLf
Me.PrimaryClient.SetFocus
Cancel = True
End If
If ((IsNull(Me.PrimaryClientDept) Or Me.PrimaryClientDept = "")) Then
strMessage = strMessage & "You must fill in Primary Client Dept" & vbCrLf
Me.PrimaryClientDept.SetFocus
Cancel = True
End If
If ((IsNull(Me.ProjectType) Or Me.ProjectType = "")) Then
strMessage = strMessage & "You must fill in Project Type" & vbCrLf
Me.ProjectType.SetFocus
Cancel = True
End If
If ((IsNull(Me.DepartmentID) Or Me.DepartmentID = "")) Then
strMessage = strMessage & "You must fill in DepartmentID" & vbCrLf
Me.DepartmentID.SetFocus
Cancel = True
End If
MsgBox = strMessage

End Sub

rconverse
01-13-2008, 09:14 AM
What isn't working?