Results 1 to 5 of 5
  1. #1
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85

    Mulitple MsgBox with different responses

    Hi, I am trying to create vb to ask me multiple questions and depending on the answer I would like to either ask another question or go to a control on my form.
    I would like to change the MsgBox in red below to be questions if the answer is yes I would like for one thing to happen and if no for something different to happen. They are currently just a msgbox with ok button. So I need them to be vbYesNo but I can not figure out how to get this to work. I have tried many different things with no luck.

    Here is my code:
    Private Sub purgebtnsrch_Click()
    Dim MedID As String
    ' Get Value from Medicaid_ID textbox on the Form:
    Me.purgebtnsrch.SetFocus
    Me.SrchPurgeMed_ID.SetFocus
    MedID = Me.SrchPurgeMed_ID.Text
    Dim Msg, Style, Title, Response, MyString
    Msg = (Chr(10)) & " Was this Billing Number located in interChange? "
    Style = vbYesNo + vbCritical + vbDefaultButton2


    Title = "Critical"

    If IsNull(DLookup("Last_Name", "Provider", "Provider.Medicaid_ID = '" & SrchPurgeMed_ID & "'")) Then
    ' NAME is Null because the Medicaid_ID doesn't exist.

    ' NAME is not Null because the Medicaid_ID does exist.
    Response = MsgBox(Msg, Style, Title)
    If Response = vbYes Then 'User chose Yes.
    MyString = "Yes"
    DoCmd.OpenForm "PurgeFileReview", , , "Provider.Medicaid_ID = '" & SrchPurgeMed_ID & "'"
    MsgBox "Read Carefully!!!" & (Chr(13)) & (Chr(13)) & "If the provider is Termed in iC, input the Term (End) date into the 'Termed in iC' field." & (Chr(10)) & "(Termed Defined: when all Prog Elig segments have an End Date or Prog Elig is Active and Billing Number is Termed.)" & (Chr(13)) & (Chr(13)) & "Input the 'Research Completed' date." & (Chr(13)) & (Chr(13)) & "Give to Amanda for further review."
    MsgBox "If provider is ACTIVE!!!" & (Chr(13)) & (Chr(13)) & "Accuracy check/add all data for fields in Green." & (Chr(13)) & (Chr(13)) & "Add 'Doc_Date' in 'File Purge Log' subform for each dated document." & (Chr(13)) & (Chr(13)) & "(Do Not repeat same date.)"

    Else 'User chose No.
    MyString = "No" 'Perform some action.
    MsgBox (Chr(10)) & " Please give file to Amanda for further review." & (Chr(13)) & (Chr(13)) & " Ready to process next file."
    End If
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Not sure what you need. Code shows you know how to apply MsgBox with Yes/No buttons. Use another If Then conditional construct. What condition should determine which MsgBox pops?
    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.

  3. #3
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    My problem is I can not figure out where to insert. Look below at the items in green.

    Do I have to create this for each msg?
    Dim Msg, Style, Title, Response, MyString
    Msg = (Chr(10)) & " Input message here. "
    Style = vbYesNo + vbCritical + vbDefaultButton2
    Title = "Critical"


    Here is my code:
    Private Sub purgebtnsrch_Click()
    Dim MedID As String
    ' Get Value from Medicaid_ID textbox on the Form:
    Me.purgebtnsrch.SetFocus
    Me.SrchPurgeMed_ID.SetFocus
    MedID = Me.SrchPurgeMed_ID.Text
    Dim Msg, Style, Title, Response, MyString
    Msg = (Chr(10)) & " Was this Billing Number located in interChange? " If this answer is yes, I would like to ask if the billing number is active with a yes / no asking another question.
    If the answer is No, I would like for a control (TermDate) to have focus. If you could show me how to get the next question I can probably figure out the rest.

    Style = vbYesNo + vbCritical + vbDefaultButton2
    Title = "Critical"

    If IsNull(DLookup("Last_Name", "Provider", "Provider.Medicaid_ID = '" & SrchPurgeMed_ID & "'")) Then
    ' NAME is Null because the Medicaid_ID doesn't exist.

    ' NAME is not Null because the Medicaid_ID does exist.
    Response = MsgBox(Msg, Style, Title)
    If Response = vbYes Then 'User chose Yes.
    MyString = "Yes"
    DoCmd.OpenForm "PurgeFileReview", , , "Provider.Medicaid_ID = '" & SrchPurgeMed_ID & "'"
    MsgBox "Read Carefully!!!" & (Chr(13)) & (Chr(13)) & "If the provider is Termed in iC, input the Term (End) date into the 'Termed in iC' field." & (Chr(10)) & "(Termed Defined: when all Prog Elig segments have an End Date or Prog Elig is Active and Billing Number is Termed.)" & (Chr(13)) & (Chr(13)) & "Input the 'Research Completed' date." & (Chr(13)) & (Chr(13)) & "Give to Amanda for further review."
    MsgBox "If provider is ACTIVE!!!" & (Chr(13)) & (Chr(13)) & "Accuracy check/add all data for fields in Green." & (Chr(13)) & (Chr(13)) & "Add 'Doc_Date' in 'File Purge Log' subform for each dated document." & (Chr(13)) & (Chr(13)) & "(Do Not repeat same date.)"

    Else 'User chose No.
    MyString = "No" 'Perform some action.
    MsgBox (Chr(10)) & " Please give file to Amanda for further review." & (Chr(13)) & (Chr(13)) & " Ready to process next file."
    End If
    End If
    End Sub

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Don't have to use variables for each message.

    If MsgBox("Was this Billing Number located in interChange?", vbYesNo + VbCritical + vbDefaultButton2) = vbYes Then
    If MsgBox("Is the billing number active", vbYesNo + VbCritical + vbDefaultButton2) = vbYes Then
    'do this
    Else
    'do this
    End If
    Else
    'do this
    End If

    Do you really have to ask the users? Can't you just have code do this validation? What is interChange?
    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.

  5. #5
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85
    interChange is our MMIS system. I am creating the form to be dummy proof to some extent.
    I will try this.
    Thanks,
    Lisa

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

Similar Threads

  1. how to sum total number of responses
    By mdnikki in forum Reports
    Replies: 3
    Last Post: 02-20-2013, 03:33 PM
  2. Accumulating A Value from Mulitple Tables
    By EddieN1 in forum Queries
    Replies: 3
    Last Post: 09-26-2012, 06:47 AM
  3. Count responses based on entires of other table
    By VictoriaAlbert in forum Queries
    Replies: 2
    Last Post: 10-18-2011, 11:06 PM
  4. Report from survey responses
    By Saramj in forum Reports
    Replies: 0
    Last Post: 02-20-2011, 04:59 PM
  5. Conditional Responses in Form
    By jheintz57 in forum Forms
    Replies: 7
    Last Post: 03-31-2010, 09:57 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