Results 1 to 6 of 6
  1. #1
    Master Klick is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    47

    Button to update criteria

    Help2.zip

    Above is a sample of my databse. In the form there is a "Qty" button. It is suppose to, when clicked, toggle between showing all items and only items I have in stock (showing >0 qty).
    I had it working in other databases but it will not function in this one. I have no clue why.

    Any ideas? I'm sure it's probably something stupid, it always is.

  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
    53,615
    The button is running an UPDATE sql. An UPDATE sql is to modify data in table, not set filter criteria.

    Why are you using a listbox instead of just setting the RecordSource of form to the SQL and use code to set form Filter property?

    Why pull so many fields into the listbox RowSource?
    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
    Master Klick is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    47
    Quote Originally Posted by June7 View Post
    The button is running an UPDATE sql. An UPDATE sql is to modify data in table, not set filter criteria.

    Why are you using a listbox instead of just setting the RecordSource of form to the SQL and use code to set form Filter property?

    Why pull so many fields into the listbox RowSource?
    That's how I was about to get it to work. I am an amateur at this. Most of that database I put together by picking apart other databases and just figuring out what different pieces of code and whatnot basically do. I think I've don't pretty good considering how far I got without any actual training. And it still works. Does exactly what I need it to do. I just can't get that one button to work.

  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
    53,615
    It doesn't work because you are using the wrong SQL. The listbox RowSource should be a SELECT not an UPDATE.
    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
    Master Klick is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    47
    Quote Originally Posted by June7 View Post
    It doesn't work because you are using the wrong SQL. The listbox RowSource should be a SELECT not an UPDATE.
    I don't understand, the rowsource says "SELECT InvQuery.ID, InvQuery.Qty, InvQuery.Name, InvQuery.Edition, InvQuery.Color, InvQuery.[Card Type], InvQuery.[Card Subtype], InvQuery.[Image Path 1], InvQuery.Power, InvQuery.Toughness, InvQuery.Loyalty, InvQuery.CMC, InvQuery.[Mana cost], InvQuery.[Mana Gen], InvQuery.Rarity, InvQuery.[Price Low], InvQuery.[Price Mid], InvQuery.[Price High], InvQuery.Artist, InvQuery.Ability, InvQuery.[Flavor text],

    It does say SELECT.

    Did you mean in VBA? I changed that to select but I must have to change something else because it still doesn't work.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,615
    The posted db is running an UPDATE sql in the QtyBut click event procedure, not filtering the listbox.
    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.

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

Similar Threads

  1. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  2. Toggle button to control criteria
    By Master Klick in forum Access
    Replies: 14
    Last Post: 07-29-2013, 09:51 PM
  3. Replies: 13
    Last Post: 02-04-2013, 04:08 AM
  4. Toggle Button Criteria
    By tylerg11 in forum Forms
    Replies: 2
    Last Post: 03-02-2012, 09:28 AM
  5. Search Button with Multiple Criteria
    By injanib in forum Forms
    Replies: 2
    Last Post: 01-12-2011, 02:21 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