Results 1 to 11 of 11
  1. #1
    tsamrein is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2017
    Posts
    6

    Run query based on specific field entered into a form

    Hello all. I am new to access and I am trying to create a query that when ran will pull data from the PART_ID field in my form. I don't want the user to have to enter the data twice.

    This is what I attempted to use but it is not pulling any data.


    [Forms]![f_BidPlanner].[PART_ID]

    Thanks in advance for the help.

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Remove the first set of brackets; FORMS not [FORMS]

  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
    Make sure you've hit Enter or Tab after entering a part to commit the value. Otherwise the query won't see it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    tsamrein is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2017
    Posts
    6
    davegri- I tried, but the brackets are automatically added when typing this in the criteria field.

    pbaldy- I have entered in all information I can in the form. Still not working.

    So I need to use an event procedure from the button I am using to run the query and do a selectobject or something?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You should be able to just run the query to test. What's the SQL of the query?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    tsamrein is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2017
    Posts
    6
    SELECT dbo_PURC_ORDER_LINE.PART_ID, dbo_VENDOR.NAME, dbo_PURC_ORDER_LINE.ORDER_QTY, dbo_PURC_ORDER_LINE.UNIT_PRICE, dbo_PURCHASE_ORDER.ORDER_DATE
    FROM tHeader INNER JOIN ((dbo_VENDOR INNER JOIN dbo_PURCHASE_ORDER ON dbo_VENDOR.[ID] = dbo_PURCHASE_ORDER.[VENDOR_ID]) INNER JOIN dbo_PURC_ORDER_LINE ON dbo_PURCHASE_ORDER.[ID] = dbo_PURC_ORDER_LINE.[PURC_ORDER_ID]) ON tHeader.PART_ID = dbo_PURC_ORDER_LINE.PART_ID
    WHERE (((dbo_PURC_ORDER_LINE.PART_ID)=[FORMS]![f_BidPlanner].[PART_ID]))
    ORDER BY dbo_PURCHASE_ORDER.ORDER_DATE DESC;

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Does it return records if you hard code an ID? Or have no criteria? Trying to determine if it's the joins. Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    tsamrein is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2017
    Posts
    6
    I have attached the database. Yes I get data returned when hardcoding a part id

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Doesn't look like it attached. Try a compact/repair and then zip first.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    tsamrein is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2017
    Posts
    6
    Sorry, for the delay. I attached the database again.
    Attached Files Attached Files

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Offhand it looks okay. I can't test without data though.
    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: 9
    Last Post: 08-11-2016, 11:30 AM
  2. Replies: 5
    Last Post: 06-01-2016, 04:34 AM
  3. Replies: 5
    Last Post: 02-10-2015, 08:26 PM
  4. Replies: 3
    Last Post: 01-09-2015, 05:48 PM
  5. Replies: 1
    Last Post: 11-10-2009, 03:20 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