Results 1 to 2 of 2
  1. #1
    Rwathen10 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2015
    Posts
    13

    Is there a way to have Access ask which field to search values from?


    I have been putting off this question for 2 weeks now, but I have not been able to figure it out on my own.

    Is there a way to have Access ask me (like a parameter query), which field to get values from?

    I have Expense Reports for different months from Cognos that look like this:
    ExpenseCodes Measurement Jan, 2015 Feb, 2015 Mar, 2015
    00000-BUDGETED SAVINGS Month Var 8 898 1032
    00000-BUDGETED SAVINGS YTD Actual 75 965 1099
    00000-BUDGETED SAVINGS YTD Rev Bud 142 1032 1166
    00000-BUDGETED SAVINGS YTD Var 209 1099 1233
    00000-BUDGETED SAVINGS YTD Var% 276 1166 1300
    00001-PROFESSIONAL Month Var 343 1233 1367
    00001-PROFESSIONAL YTD Actual 410 1300 1434
    00001-PROFESSIONAL YTD Rev Bud 477 1367 890
    00001-PROFESSIONAL YTD Var 544 1434 890

    For example, How can I have Access ask me which of the three columns (Jan, 2015, Feb, 2015 or Mar, 2015) to give me the "YTD Var" value of "00000-Budgeted Savings"? As I replace this data throughout the month, I want cognos to ask me what Field/Month I am working from so that I don’t have to update my query to get data from the new column? Also, I may forget to update it one month, so I want something that asks me what field.

    Thanks very much in advanced.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    What you actually have here is a design issue, your table is not normalized.
    Instead of having multiple fields (columns) for each month, you should have a separate record for each month. So each records would have a month field and an amount field.

    Then, to query what you want, it is just a matter of selecting/entering the appropriate criteria in the month field.

    Here is a good article which talks about data normalization: https://support.office.com/en-us/art...rs=en-US&ad=US

    Otherwise, if you don't want to manually update your query every time, you might need to use VBA to dynamically build the SQL code of the query you wish to return (so that would involve both VBA and SQL).

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

Similar Threads

  1. Replies: 18
    Last Post: 03-26-2015, 07:26 AM
  2. Replies: 25
    Last Post: 05-13-2014, 12:06 PM
  3. Date Range search on Field with null Values
    By vbafun in forum Queries
    Replies: 6
    Last Post: 12-06-2013, 07:26 AM
  4. Replies: 7
    Last Post: 08-24-2012, 04:08 PM
  5. How to Search a Text Field in Access
    By cnbhold in forum Access
    Replies: 1
    Last Post: 01-11-2010, 05:56 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