thisisntwally
CE&A
- Local time
- Today, 14:37
- Joined
- Jun 27, 2007
- Messages
- 246
ok, so im trying to validate the values in a forms fields with vba. the function is called at the start of my onclick event as such:
While the values in my If statements display the correct values when stepping through, it seems to ignore this, skips the message box and cancel = true, and proceeds to the next if all the way through the function. I thought that all i needed was if ....then msgbox "..." cancel = true end if. Is my If statement invalid? or what? Im kinda baffled here.
this is the function:
Code:
Call amdValid(Forms![Input Form])
While the values in my If statements display the correct values when stepping through, it seems to ignore this, skips the message box and cancel = true, and proceeds to the next if all the way through the function. I thought that all i needed was if ....then msgbox "..." cancel = true end if. Is my If statement invalid? or what? Im kinda baffled here.
this is the function:
Code:
Public Function amdValid(vFrm As Form)
If (vFrm!txtSSD - vFrm!txtDOR) > 3 And vFrm!txtComments = "" Then
MsgBox "Turnaround Time is greater than 3 days, please comment."
Cancel = True
End If
If (vFrm!txtSSD Or vFrm!txtDOR) = "" And vFrm!chkStatus = "" Then
MsgBox "Please include Date of Reciept or Site Submission Date"
Cancel = True
End If
If vFrm!objRequest = "" Then
MsgBox "Please attach Request Document"
Cancel = True
End If
If vFrm!cboPurchaseOrder = "" Then
MsgBox "Please Select a PO number. If you need to input a new PO number click the add button to the right of the PO field"
Cancel = True
End If
If vFrm!txtvalue = "" Then
MsgBox "Please Include a Dollar Value for this Record"
Cancel = True
End If
End Function