Solved Msgbox display (1 Viewer)

Rania01

Member
Local time
Today, 02:04
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
    448 KB · Views: 251
  • Photos1.jpg
    Photos1.jpg
    10.9 KB · Views: 239
  • Photos2.jpg
    Photos2.jpg
    27 KB · Views: 229

Gasman

Enthusiastic Amateur
Local time
Today, 01:04
Joined
Sep 21, 2011
Messages
14,350
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? :(
 

Rania01

Member
Local time
Today, 02:04
Joined
Oct 9, 2021
Messages
59
Dear Gasman,

Could you please help, You can check my file

Thank you
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:04
Joined
Sep 21, 2011
Messages
14,350
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
 

moke123

AWF VIP
Local time
Yesterday, 20:04
Joined
Jan 11, 2013
Messages
3,927
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:04
Joined
May 7, 2009
Messages
19,247
here are some "suggestions".
see the codes on your form.
 

Attachments

  • Data.accdb
    512 KB · Views: 257

Rania01

Member
Local time
Today, 02:04
Joined
Oct 9, 2021
Messages
59
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

Top Bottom