![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a db w/3 required fields, I'm using the follow code to validate on the forms before update, which works fine. Problem is user are selecting the command button, which sends out an email message, I don't want the message sent out unless the required fields are filled out. I've tried a few different lines of code w/no success, the portion in between --------------- Private Sub cmdSendEmail_Click() 'ea of 3 controls under properties: All: Tags set to Required Dim blnContinue As Boolean Dim ctl As Control blnContinue = True For Each ctl In Me.Controls If ctl.Tag = "Required" Then If IsNull(ctl) Then ' If Nz(ctl, "") = "" Then Tried this too MsgBox "Field(s)indicated in red must contain data. ", vbCritical + vbOKOnly + vbDefaultButton1, "Required Information Missing" -------------------------------------------------------------------------------------------------- DoCmd.CancelEvent Exit Sub 'Cancel = True -------------------------------------------------------------------------------------------------- ctl.SetFocus Exit For End If End If Next ctl Set ctl = Nothing OpenEmailRequestFraser End Sub |
![]() |
| Thread Tools | |
| Display Modes | |
| |