Results 1 to 11 of 11
  1. #1
    buck is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    26

    Message Box

    Hopefully a simple question: I have a command button with the VBA code below. I'd like a message box to appear with a comment and an "OK" button that continues the code below . . is this possible?



    Private Sub cmdDuplicateOverpayments_Click()
    On Error GoTo Err_cmdDuplicateOverpayments_Click

    Dim stDocName As String

    stDocName = "qryFindduplicatesforOverpaymentsDetails"
    DoCmd.OpenQuery stDocName, acNormal, acEdit
    Exit_cmdDuplicateOverpayments_Click:
    Exit Sub
    Err_cmdDuplicateOverpayments_Click:
    MsgBox Err.Description
    Resume Exit_cmdDuplicateOverpayments_Click

    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Have you looked at MsgBox in VBA help?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    buck is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    26
    yes before coming to forum

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    So

    MsgBox "your comment here"

    Doesn't do what you want? If not, you might be more specific about what you want and why MsgBox doesn't fit.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    buck is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    26
    I thought the question was simple enough, not sure how else to ask. . . Can the code above be modified to include a message box?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Yes; add the line:

    MsgBox "your comment here"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Why are you opening a query? Users should not interact directly with tables and query, better to use forms and reports as interface.

    Put the MsgBox line wherever you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    buck is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    26
    It is a form with a command button as explained in early post. I've already gotten the answer from another forum. Thanks anyway

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    It might help someone here if you post the answer you got. I'd love to see what it was myself.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    buck is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    26
    MsgBox "PUT MESSAGE HERE", vbOKOnly

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  2. Replies: 9
    Last Post: 09-26-2012, 12:20 PM
  3. Need Help with message box.
    By Grahamvdh in forum Programming
    Replies: 1
    Last Post: 05-10-2012, 01:29 PM
  4. Message Box
    By Alex Motilal in forum Forms
    Replies: 1
    Last Post: 03-27-2012, 08:31 AM
  5. Message Box
    By dr223 in forum Access
    Replies: 11
    Last Post: 01-12-2012, 11:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums