Solved Msgbox display

Rania01

Member
Local time
Tomorrow, 00:11
Joined
Oct 9, 2021
Messages
59
My form contains a text box and a combo box.
I would like only When a value is selected from the combo box I want it to be displayed msgbox "Date Entry Required" if in the text box (Date) is empty.
The combo box contains a list I would greatly appreciate help on this.
Thanks in advance
 

Attachments

  • Data.accdb
    Data.accdb
    448 KB · Views: 288
  • Photos1.jpg
    Photos1.jpg
    10.9 KB · Views: 276
  • Photos2.jpg
    Photos2.jpg
    27 KB · Views: 264
Use the BeforeUpdate eevent of the form to check you have required values.
I personally would swap the position of your controls.
Makes little sense to me to get to a control, only for find I should have completed a previous control? :(
 
Dear Gasman,

Could you please help, You can check my file

Thank you
 
Something along the lines of
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Len(Me.cboFeedback & "") > 0 And Me.cboFeedback <> "No FeedBack" Then
    If Len(Me.txtDate & "") = 0 Then
        MsgBox "Date mandatory if Feedback supplied"
        Cancel = True
    End If
End If
    
End Sub
 
If the date they need to select is usually the current date you could set a default date for the control.
You also should not use Date as a field name as it is a reserved word.
 
here are some "suggestions".
see the codes on your form.
 

Attachments

Dear arnelgp,

This is what i'm looking for, is working

@Gasman your VBA also work,

Thank you for all of your help and support

 

Users who are viewing this thread

Back
Top Bottom