+ Reply to Thread
Results 1 to 5 of 5

How to make a message box pop up in user form

Hybrid View

  1. #1
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to make a message box pop up in user form

    The code I provided would go at the top of your UpdateForm macro. (the part in red)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  2. #2
    Registered User
    Join Date
    07-06-2015
    Location
    Phoenix , AZ
    MS-Off Ver
    2010
    Posts
    47

    Re: How to make a message box pop up in user form

    Ok so I put the code below but I get an error and when I debug it outlines the Sub field



    Sub Update_Form()
    
    Dim t As Control, res As VbMsgBoxResult
    
    For Each t In Me.Controls
        If TypeName(t) = "TextBox" Then ' Make sure we're only looking at textboxes.
            If t.Text = vbNullString And t.Tag <> vbNullString Then
                res = MsgBox("You've not completed the " + t.Tag + " field. Would you like to complete it now?", vbYesNo + vbQuestion)
    
                If res = vbYes Then Exit Sub
        End If
    Next
    txtass.Value = Cells(Currentrow, 1).Value
    TxtComp.Value = Cells(Currentrow, 2).Value
    TxtDoc.Value = Cells(Currentrow, 3).Value
    Txtdlname.Value = Cells(Currentrow, 4).Value
    txtdoct.Value = Cells(Currentrow, 5).Value
    Txtdocto.Value = Cells(Currentrow, 6).Value
    TxtFname.Value = Cells(Currentrow, 7).Value
    TxtLname.Value = Cells(Currentrow, 8).Value
    TxtIns.Value = Cells(Currentrow, 9).Value
    Txteml.Value = Cells(Currentrow, 10).Value
    TxtPho.Value = Cells(Currentrow, 11).Value
    Txtcellp.Value = Cells(Currentrow, 12).Value
    Txtgndr.Value = Cells(Currentrow, 13).Value
    Txtrac.Value = Cells(Currentrow, 14).Value
    TxtDOB.Value = Cells(Currentrow, 15).Value
    Txtage.Value = Cells(Currentrow, 16).Value
    Txthin.Value = Cells(Currentrow, 17).Value
    Txtwip.Value = Cells(Currentrow, 18).Value
    Txtwd.Value = Cells(Currentrow, 19).Value
    Txttcl.Value = Cells(Currentrow, 20).Value
    Txttcld.Value = Cells(Currentrow, 21).Value
    Txthdl.Value = Cells(Currentrow, 22).Value
    Txtldl.Value = Cells(Currentrow, 23).Value
    Txtbps.Value = Cells(Currentrow, 24).Value
    Txtbpd.Value = Cells(Currentrow, 25).Value
    Txtbptd.Value = Cells(Currentrow, 26).Value
    Txtla1c.Value = Cells(Currentrow, 27).Value
    Txtla1cd.Value = Cells(Currentrow, 28).Value
    Txtedwd.Value = Cells(Currentrow, 29).Value
    Txtdd.Value = Cells(Currentrow, 30).Value
    Txtsw.Value = Cells(Currentrow, 31).Value
    Txtevr.Value = Cells(Currentrow, 32).Value
    Txtdn.Value = Cells(Currentrow, 33).Value
    
       End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Make a Search User Form
    By ruveenck in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2014, 09:46 AM
  2. Make user input form to update inventory
    By jcmckeon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-09-2013, 07:29 AM
  3. [SOLVED] How to make a MSGBOX always pop up on top of the user form
    By delaneybob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2012, 07:21 PM
  4. Image instead of message in User form
    By Tunk Ayauit in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-28-2011, 01:55 PM
  5. Message populate while closing user form
    By rajeev.raj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-24-2010, 08:18 AM
  6. User form textbox message for input error
    By microsmith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2007, 02:50 PM
  7. make User Form inactive
    By vandanavai in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-24-2006, 04:51 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1