PDA

View Full Version : Msgbox when textbox not filled but on choice (yes/no)



djemy1975
04-24-2016, 07:28 AM
Dear developpers,

I want to have a pop up msgbox when data is not entered in some textboxes in my form ,but on choice,i.e :I would not be obliged to enter records in ("txtPO","txtPO1","txtPO2","txtPO3") unless I could save my data.

I have this piece of code:

'If Me.txtPO.Value = "" And Me.txtPO1 = "" And Me.txtPO2 = "" And Me.txtPO3 = "" Then'MsgBox "Vous devez insérer le numéro de bon de commande s'il existe!", vbOKCancel, "Bon de Commande"
'Exit Sub
'End If

Could some one help me to custom this code to be able either fill in those textboxes or let them blank.

Herewith my file also to make more clear.

Thanks in advance,

gmaxey
04-24-2016, 02:55 PM
If txtPO.Value = "" Or txtPO1 = "" Or txtPO2 = "" Or txtPO3 = "" Then
If MsgBox("One or more text fields is empty. Do you want to go back and fill them in?", vbQuestion + vbYesNo, "EMPTY FIELD") = vbYes Then
Exit Sub
End If
End If
'Go on processing

djemy1975
04-24-2016, 03:09 PM
thank you for your reply.I will test it and make you know.

Thanks,

djemy1975
04-24-2016, 03:12 PM
If txtPO.Value = "" Or txtPO1 = "" Or txtPO2 = "" Or txtPO3 = "" Then
If MsgBox("One or more text fields is empty. Do you want to go back and fill them in?", vbQuestion + vbYesNo, "EMPTY FIELD") = vbYes Then
Exit Sub
End If
End If
'Go on processing

Many thanks .It is exaclty what I need...