Results 1 to 9 of 9
  1. #1
    SusanHRO is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    7

    Run Query Button Not Working

    Hi.
    I have a query, and as the criteria for one of the fields I have it referencing a drop box I made in a form. It works: I can open the form, select my option, go to my query, click run, and it all works fine.

    But now I want to put a Run Query button onto my form, so that others can easily use it without going to the actual query to click run.
    I used the Command Button - selected Miscellaneous,
    Run Query, clicked the correct query, and gave it text and a title.

    However, when I go to my form and press this new Run Query button, nothing happens. What am I doing wrong?



    Any help is appreciated!

  2. #2
    SusanHRO is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    7

    Code

    I went to View Code and I believe this is the code for my button, if that's helpful to anyone. (I don't now how to use MVB so its greek to me)

    Private Sub Command8_Click()
    On Error GoTo Err_Command8_Click

    Dim stDocName As String

    stDocName = "Project Specific Query"
    DoCmd.OpenQuery stDocName, acNormal, acEdit

    Exit_Command8_Click:
    Exit Sub

    Err_Command8_Click:
    MsgBox Err.Description
    Resume Exit_Command8_Click

    End Sub

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If nothing is happening and you went through the command button wizard I suspect that you've changed the name of your button after you created the event procedure. Make sure the NAME of your button (the very first field when you look at the properties) is Command8. If it's not, change all the references in your code that you posted from Command8 to whatever the button is currently named.

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    And if it is named Command8 then make sure that you are running the database from a TRUSTED LOCATION so that code is enabled.

    See here for more about that:
    http://www.btabdevelopment.com/ts/de...aspx?PageId=13

  5. #5
    SusanHRO is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    7
    No luck ... it's so strange that I don't even get an error box or anything. Nothing at all happens.

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    can you enclose a sample database (with fake data) to look at.

  7. #7
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Susan:

    Not strange but just needing to troubleshoot.

    Go into the form in design view, click on the button to select it, go to the properties dialog and the EVENTS tab and look in the click event and make sure that [Event Procedure] is listed like that. Sometimes some things can disassociate it (like copying to or from a tab control) and then you have to go back and select [Event Procedure] again.

  8. #8
    SusanHRO is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    7
    Event Procedure is listed correctly.

    rpeare - what exactly do you want to see? i have a monster table, a query referencing that, a query referencing the query, and then a form trying to run that query.

  9. #9
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Just a copy of the database, without any sensitive information in it so that there should be at least *1* record in the return query. From your description the query is not returning anything (the button is not even doing anything) so if you blank out all of your data and put in 1 or 2 records then zip up this copy and post it here (access 2003 or below please) we can look at it

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

Similar Threads

  1. Edit button not working
    By elamaranr in forum Access
    Replies: 0
    Last Post: 07-25-2011, 01:45 PM
  2. Working With Query Defs
    By AccessGeek in forum Programming
    Replies: 1
    Last Post: 03-14-2011, 09:56 AM
  3. Add Record Button isn't working
    By tmcrouse in forum Forms
    Replies: 6
    Last Post: 08-02-2010, 02:09 PM
  4. IIf Update Query working OK but a better way?
    By dreamweaver547 in forum Queries
    Replies: 7
    Last Post: 04-19-2010, 09:47 AM
  5. Query is not working
    By pushpm in forum Programming
    Replies: 3
    Last Post: 04-14-2009, 07:16 PM

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