Results 1 to 15 of 15
  1. #1
    reburton is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    14

    Parameters driving me mad

    I have a number of queries that use parameters and they all prompt me multiple times for the same input, especially if I run them from a report. When I try to edit the reports the prompt keeps popping up asking me for a date. Is there any way to stop this?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I would have the user enter the parameter on a form, and have the queries get it from there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    reburton is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    14
    Thanks for replying so quickly! I am sure that's a better way to do it, but I'm afraid I don't know enough SQL to pull it off.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You can right-click and use Build in the criteria, or replace the bracketed criteria:

    [Enter whatever]

    with a reference to the form:

    Forms!FormName.TextboxName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    reburton is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    14
    Many thanks! That, I think I can handle. I'm rather green at this and I really appreciate your help.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Annoying prompts is why I don't use dynamic parameterized queries. I use code to build filter criteria. Use the constructed filter to:

    1. set Filter and FilterOn properties of form

    2. set the WHERE CONDITION of OpenForm (or OpenReport)
    DoCmd.OpenForm "form name", , , strCriteria

    Review http://allenbrowne.com/ser-62code.html
    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.

  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,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    reburton is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    14
    I know I'm getting to be a nuisance, but I am still having a hard time with the solution that pbaldy suggested. I used the expression builder like he suggested and Access put up a message stating that my values were not valid. I used: =[Forms]![EnterStartDateFrm]![txtStartDate] the only thing I added was the = sign. The rest was straight from the expression builder. I don't know very much about forums either, so I don't know if posting this after it is marked "Solved" will even get it seen.

  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,652
    In design view of a query you wouldn't want the =.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    reburton is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    14
    I thought of that before I posted, but when tried to delete it Access plugged it right back in. and then complained that the Field address was invalid. I know this must be something I'm doing wrong but I am stumped.

  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,652
    Can you post the SQL of the original query?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    reburton is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    14
    I am embarrassed to say I finally figured out how to accomplish what I needed to do. Part of my problem was an error in my logic. Another was an incorrect join.
    I still don't have a handle on getting a value from a form, but I'm working on it; I really hate those parameters in the queries. Could you send me a segment of code to show me how it is done?
    I really appreciate your spoon-feeding me like this. I am handicapped and only able to use two fingers to type so I do a lot of cutting and pasting. A snippet of cade really is helpful. Thanks again!

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    In design view it looks like this:
    Attached Thumbnails Attached Thumbnails Parameter.jpg  
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I referenced in post 6 a link to article that shows VBA alternative.
    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.

  15. #15
    reburton is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    14
    Thanks a million! I'll give this a whirl later on this evening.

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

Similar Threads

  1. Too few arguments is driving me crazy....
    By Spidee in forum Access
    Replies: 3
    Last Post: 07-10-2013, 07:41 AM
  2. I know it's easy but it's driving me crazy!!!
    By pensived in forum Queries
    Replies: 1
    Last Post: 02-22-2012, 02:55 AM
  3. ShipToCode is driving me crazy
    By Accessgrasshopper in forum Access
    Replies: 7
    Last Post: 02-26-2011, 04:55 PM
  4. Report issue driving me crazy
    By Grofica in forum Reports
    Replies: 11
    Last Post: 01-28-2011, 11:23 AM
  5. Pls help... driving me insane!
    By Maverick1501 in forum Reports
    Replies: 1
    Last Post: 03-31-2010, 06:26 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