Results 1 to 5 of 5
  1. #1
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    209

    Comments when clicking a button


    There is a form that I create, I have a buton that run a query, how would I add a statement that show, when button clicked that asks, are you sure you want to run this query?! And they have the option of yes/no.


    Can someone provide some reading material for me to learn further on how to do this trick?

  2. #2
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254

    Juan4412 -

    If you are using VBA (Button: OnClick=[EventProcedure]) to Open the query, you could try this -

    If MsgBox("Click YES if you are sure you want to run this query. Otherwise, Click NO!", vbYesNo + vbQuestion, "Run Query ?") = vbYes Then
    DoCmd.OpenQuery "YourQueryName"
    Else
    Exit Sub
    End If

    Hope this helps,

    Jim

  3. #3
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    209
    Sweet, that is excremely simple! Thank you for time/assistance. Is it always in this format....

    If MsgBox("Click YES if you are sure you want to run this query. Otherwise, Click NO!", vbYesNo + vbQuestion, "Run Query ?") = vbYes Then

    Like could I add in a = vbNo then?

    Like how would I say that if = vbNo Then
    go back to form that you were on.

    Does that make sense?

  4. #4
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254

    Juan4412 -

    There are a number of ways you can change/customize the MsgBox to meet the needs of your application/users.

    As a starting point, go to the VB editor, Help (F1), search for MsgBox Function. It should explain all of the options that are available.

    Hope that gets you started.

    All the best,

    Jim

  5. #5
    Juan4412 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    209
    That showed me what I needed, thank!

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

Similar Threads

  1. Your comments on this school database system please
    By crazycat503 in forum Database Design
    Replies: 3
    Last Post: 05-24-2011, 09:28 AM
  2. Clicking links in webpages
    By dssrun in forum Programming
    Replies: 5
    Last Post: 01-16-2011, 09:04 PM
  3. Enable button in the master form when clicking in the detail
    By DistillingAccess in forum Programming
    Replies: 8
    Last Post: 08-03-2010, 10:54 AM
  4. Clicking on label opens up new record
    By swimmermx in forum Forms
    Replies: 2
    Last Post: 07-20-2010, 03:58 PM
  5. Comments box
    By allykid in forum Forms
    Replies: 1
    Last Post: 07-12-2010, 08:45 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