SpeedThink
Registered User.
- Local time
- Today, 16:09
- Joined
- Mar 10, 2005
- Messages
- 15
Appreciate a resolution concerning the following:
Able to display a message box that indicates the correct text box that is missing data.
However, after the message box displays, the end-user is able to go to the next record which is unacceptable.
I would desire that if the missing data issue is not resolved, then the end-user cannot go to another
record.
I am calling the function in the form's before update event as displayed below:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Call RequiredData(Form)
End Sub
Public Function RequiredData(ByVal TheForm As Form) As Boolean
Dim i As Integer
Dim strName As String
For i = 1 To 4
If Not IsNull(TheForm("txtAmtSubmitted" & i)) Then
If Not IsDate(TheForm("txtDateSubmitted" & i)) Then
strName = "txtDateSubmitted" & i
Exit For
End If
If Not IsDate(TheForm("txtFollowupDate" & i)) Then
strName = "txtFollowupDate" & i
Exit For
End If
End If
If Not IsNull(TheForm("txtAmtReceived" & i)) Then
If Not IsDate(TheForm("txtDateReceived" & i)) Then
strName = "txtDateReceived" & i
Exit For
End If
End If
Next
If strName <> "" Then
MsgBox "Data is required in " & strName & "," & vbCr & _
"please ensure this is entered.", _
vbInformation, "Required Data..."
RequiredData = True
Else
RequiredData = False
End If
End Function
Able to display a message box that indicates the correct text box that is missing data.
However, after the message box displays, the end-user is able to go to the next record which is unacceptable.
I would desire that if the missing data issue is not resolved, then the end-user cannot go to another
record.
I am calling the function in the form's before update event as displayed below:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Call RequiredData(Form)
End Sub
Public Function RequiredData(ByVal TheForm As Form) As Boolean
Dim i As Integer
Dim strName As String
For i = 1 To 4
If Not IsNull(TheForm("txtAmtSubmitted" & i)) Then
If Not IsDate(TheForm("txtDateSubmitted" & i)) Then
strName = "txtDateSubmitted" & i
Exit For
End If
If Not IsDate(TheForm("txtFollowupDate" & i)) Then
strName = "txtFollowupDate" & i
Exit For
End If
End If
If Not IsNull(TheForm("txtAmtReceived" & i)) Then
If Not IsDate(TheForm("txtDateReceived" & i)) Then
strName = "txtDateReceived" & i
Exit For
End If
End If
Next
If strName <> "" Then
MsgBox "Data is required in " & strName & "," & vbCr & _
"please ensure this is entered.", _
vbInformation, "Required Data..."
RequiredData = True
Else
RequiredData = False
End If
End Function