Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    magicmike92 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    11

    Query Paramater Connection

    Hi There,



    I have two queries. One has a date criteria. I want the other one to recognize the date in the first query, and subtract 12 months from it. So essentially one query will have todays date this year and the second query will have todays date last year but I only have to input the date into the first query.

    Thanks!

    MagicMike92

  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,521
    Personally I'd use a form for the user to enter the date. Then both queries can use it, the second using DateAdd() to subtract.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    magicmike92 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    11
    Great! Thanks!

    Also, do you know how to subtract an alphanumeric value? For example, it is currently F13, and when I plug that into a Form, I want another drop down box to automatically change to F12 to represent last fiscal year. Does that make sense?

    Thanks!

  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,521
    You'd probably need to peel out the numeric part, subtract, and add the letter back, like:

    ?"F" & mid("F12",2) - 1
    F11
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    magicmike92 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    11
    I don't quite understand. Would I just plug that into the control source? How do I add the reference to the F13 combo box?

    Thanks!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    As a control source, something like:

    ="F" & Mid(FieldName, 2) - 1
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    magicmike92 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    11
    Thank you!!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    magicmike92 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    11
    Thanks!

    Ok also, I am trying to make a combo box dependent on another so that the choices of the second one are limited depending on what is chosen for the first combo box. Do you have any suggestions on how to go about doing this?

    Thanks!

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    magicmike92 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    11
    yeah kind of but if I put the lists in as Values, where do I write them out?

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't know. I rarely use value lists as having the data in a table is more dynamic and maintainable. Other than hard-coding values into code, I can't think of a way to do it with value lists.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    magicmike92 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    11
    Can I just make another table with the 2 lists and reference that?

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't know the nature of the data, but probably.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    magicmike92 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    11
    It's dates corresponding to a year

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Removed Enter Paramater Value
    By lsingh165 in forum Access
    Replies: 2
    Last Post: 01-28-2013, 12:52 AM
  2. Query not showing in Excel connection list
    By Reaper in forum Queries
    Replies: 1
    Last Post: 07-26-2012, 03:04 AM
  3. Replies: 1
    Last Post: 04-19-2012, 12:43 PM
  4. Replies: 1
    Last Post: 03-23-2012, 01:22 PM
  5. Date Paramater prints weird
    By NOTLguy in forum Reports
    Replies: 9
    Last Post: 10-20-2010, 07:58 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