Results 1 to 4 of 4
  1. #1
    Parker is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    76

    Access 2010 - Yes/No box in a command button - Basic Question

    Hello,

    I have a command button set up to "Print" a file. I want to ask a user "Do you want to continue printing this file?" with a Yes and No feature. Obviously if the user clicks Yes, I would like it to proceed to print. If the user clicks No I would like it to cancel the print command.



    Currently I have just been using macros... In the On Click feature there is a macro built in to automatically go to the printer. I would liek this message to pop up before it goes to print:


    Thank you All!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You can add a message box to a macro. I am not sure how you would allow the message box to stop the printing though. I use VBA. You can print a report using VBA. Here is a snippit I sometimes use when I am creating many msgboxes in a form's module. It is not perfect in that it is not all on one line but, I like it for convenience of manipulating it for any situation.

    Code:
                        Dim Msg, Style, Title, Response
                        Msg = " There was a problem scanning.  " & vbCrLf
                        Msg = Msg + " Do you want to try again?  " & vbCrLf
                        Msg = Msg + " Click No to save the white  " & vbCrLf
                        Msg = Msg + " background as part of the file.  "
                        Style = vbYesNo + vbInformation + vbDefaultButton1    ' Define buttons.
                        Title = "Bad Copy"    ' Define title.
                        Response = MsgBox(Msg, Style, Title)
                        
                            Select Case Response
                            
                            Case vbYes     ' User chose Yes.
                            Call DIB_Free(lngHdib)
                            Call TWAIN_CloseSource
                            Call TWAIN_EndMultipageFile
                            GoTo Scan_Now
                            
                            
                            Case vbNo
                            MsgBox "Your image will be saved now. "
                            GoTo Process_Now
                            
                            End Select

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Here is an example;
    If MsgBox("Would you like to Print this record?", vbYesNo, "Print Confirmation") = vbYes Then
    If MsgBox("Are you SURE you want to Print this record?" & vbCrLf & _
    "Okay,here we go.", vbYesNo, "2nd Print Confirmation") = vbYes Then
    DoCmd.RunCommand acCmdPrint
    End If
    End If
    HTH

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    If you are using purely MACROS...you can do this...
    Click image for larger version. 

Name:	msgbox macro.png 
Views:	7 
Size:	13.2 KB 
ID:	16309

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

Similar Threads

  1. Replies: 3
    Last Post: 08-04-2013, 07:11 AM
  2. Replies: 0
    Last Post: 02-17-2013, 11:17 PM
  3. Button Command Question
    By keith701a in forum Forms
    Replies: 2
    Last Post: 12-29-2011, 04:20 PM
  4. Access 2010 Forms Command button Question
    By RayMilhon in forum Forms
    Replies: 3
    Last Post: 09-12-2011, 03:38 PM
  5. Command Button Question
    By Desstro in forum Forms
    Replies: 12
    Last Post: 05-06-2010, 06:17 AM

Tags for this Thread

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