Consulting

Results 1 to 4 of 4

Thread: Msgbox when textbox not filled but on choice (yes/no)

  1. #1

    Msgbox when textbox not filled but on choice (yes/no)

    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,
    Attached Files Attached Files

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location
    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
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    thank you for your reply.I will test it and make you know.

    Thanks,

  4. #4
    Quote Originally Posted by gmaxey View Post
    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •