Results 1 to 2 of 2
  1. #1
    iPete is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    2

    Message box options not starting macro

    edit: Correct Code:

    Private Sub Command877_Click()
    Dim varResponse As Variant
    varResponse = MsgBox("Do you want to include Performance Indicators in your report?", vbInformation + vbYesNoCancel)

    If varResponse = vbYes Then
    DoCmd.RunMacro "mcrOpenReport_Pi"

    ElseIf varResponse = vbNo Then
    DoCmd.RunMacro "mcrOpenReport"

    Exit Sub

    End If

    End Sub

    Original Message:

    Hi all,

    Novice here who needs to get himself to a VBA course or 5. I've managed to scramble together a message box that has two options that need to trigger different macros in Access. Here is the code, I'm unsure as to where it is going wrong. The Message box appears to work but no Macros. It is probably something very simple to the trained eye!

    Private Sub Command877_Click()
    Dim ReportType As String
    ReportType = MsgBox("Do you want to include Performance Indicators in your report?", vbInformation + vbYesNoCancel, "ReportType")

    If (DailyReportmsgbox = vbYes) Then
    DoCmd.RunMacro "mcrOpenReport_Pi"



    ElseIf (DailyReportmsgbox = vbNo) Then
    DoCmd.RunMacro "mcrOpenReport"

    Exit Sub

    End If

    End Sub

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    FYI, a MsgBox will return an Integer value.

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

Similar Threads

  1. Questions about starting first database
    By JM9x in forum Access
    Replies: 15
    Last Post: 09-10-2011, 04:26 AM
  2. Starting a new database
    By JFo in forum Access
    Replies: 9
    Last Post: 08-25-2011, 11:00 PM
  3. Replies: 3
    Last Post: 07-04-2011, 02:44 AM
  4. Replies: 3
    Last Post: 12-06-2010, 04:06 PM
  5. Replies: 7
    Last Post: 05-21-2010, 10:37 PM

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