Results 1 to 10 of 10
  1. #1
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117

    Button that creates Yes or No msgbox that when clicked leads to different forms

    Hey Guys I have a button with the caption "Make New Test Request", I want it when clicked that a message box will appear with the Message "Have any of the following previously been sumbitted via the automated Ground Test Request System regarding these tests:


    Test Request - Estimate
    Facility Request - Estimate
    Experimental Measurement Request - Estimate"

    then I want a yes and no option. When you click on no, I want it to open a form named "Generate_ID", otherwise if you click no, it will open a form named "form3". Can anybody put code that I can use?

    Thanks, all help is appreciated!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You have it do 2 things if you click NO?

    instead of Options ,put 2 buttons. Yes btn,No btn.
    its much easier to code button click.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Here's my template code for a yes/no box:

    Code:
    Dim msg As String, button As Variant, title As String, response As Variant
    msg = "Vehicle is Shopped - Do you want to dispatch anyway?"
    button = vbYesNo + vbDefaultButton2
    title = "Vehicle Shopped!"
    
    response = MsgBox(msg, button, title)
    If response = vbYes Then
      'what to do if yes
    Else
      'what to do if not
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    oh sorry, typo, the Generate ID form is opened when you click no and the other with you click yes

  5. #5
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    Hey pbBaldy, it doesn't work, I get the message "The expression on Click you entered as the event property setting produced the following error: A problem occurred while Micrsoft Access was communicating with the OLE server or ActiveX Control.

  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,518
    I've used that template many times. What does yours look like? The error doesn't sound like it's coming from this code. See if one of these helps:

    https://social.msdn.microsoft.com/Fo...orum=accessdev
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    It didn't really help, Ill try to do some more research into it thanks though!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem. You never posted your code, so unable to say if there's a problem in it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    Ok I got it to work, the code was fine, I had to create a new form, that was all.

    Thanks Guys!

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Glad you got it sorted. It seemed like there was something wrong with the form, like corruption.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 03-16-2016, 12:33 PM
  2. Replies: 7
    Last Post: 08-18-2015, 08:05 AM
  3. Saving a Record Edit ONLY if button is clicked?
    By McArthurGDM in forum Forms
    Replies: 3
    Last Post: 06-01-2015, 09:33 PM
  4. disabling an enabled button that has been clicked.
    By aaron47 in forum Programming
    Replies: 3
    Last Post: 08-26-2011, 09:49 AM
  5. Use MsgBox to open different forms
    By blueraincoat in forum Forms
    Replies: 10
    Last Post: 03-13-2011, 10:40 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