MysticElaine
Registered User.
- Local time
- Today, 17:25
- Joined
- May 26, 2014
- Messages
- 24
I have a form that has some fields with validation rules, which are Not Is Null. I have a private function to validate records (here is a snipet)
and a form_before update sub
The form has a save and close button. I was wondering if there was a way to keep the form from closing if those fields are null. Right now, you click the button, the validation text pops up (it pops up twice too), and then the form closes. Can we keep the form open so they can fix the problem?
I thought about maybe having the (If...Then, Inputbox)code in the Form_BeforeUpdate instead. If I do that, is there a way to do that for date textboxes and comboboxes where you choose the value instead of typing it?
Thanks,
Code:
Private Function ValidateRecord() As Boolean
ValidateRecord = False
Select Case Outcome
Case "Interpretation"
If IsNull(Me.[Date Provided]) Then
MsgBox [Date Provided].ValidationText
Exit Function
End If
End Select
ValidateRecord = True
End Function
and a form_before update sub
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If ValidateRecord = False Then
Cancel = True
End If
End Sub
The form has a save and close button. I was wondering if there was a way to keep the form from closing if those fields are null. Right now, you click the button, the validation text pops up (it pops up twice too), and then the form closes. Can we keep the form open so they can fix the problem?
I thought about maybe having the (If...Then, Inputbox)code in the Form_BeforeUpdate instead. If I do that, is there a way to do that for date textboxes and comboboxes where you choose the value instead of typing it?
Thanks,