Results 1 to 9 of 9
  1. #1
    ljksmith is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4

    Help with query or filter option


    I have a database where I import a new table every other month. It contains virtually the same data with updated usage in it. What I need to do is somehow find a way to compare the meter field in the previous table with the meter field in the new table to see if they are still the same. Basically its a water usage table with addresses and meters and I need to see if the meter number has changed so I can update it. I've tried everything I can think of but I'm a self taught novice with Access. Any input would be helpful.

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You don't need to see if it has changed, you can update it regardless.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    You are creating a new table each month for that month's usage? Should import into existing table.

    If you replace the meter number, how will that impact historical records and calculation of usage?

    If you need to calculate usage, perhaps subquery technique will serve. Review http://allenbrowne.com/subquery-01.html#AnotherRecord
    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.

  4. #4
    ljksmith is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4
    Quote Originally Posted by ljksmith View Post
    I have a database where I import a new table every other month. It contains virtually the same data with updated usage in it. What I need to do is somehow find a way to compare the meter field in the previous table with the meter field in the new table to see if they are still the same. Basically its a water usage table with addresses and meters and I need to see if the meter number has changed so I can update it. I've tried everything I can think of but I'm a self taught novice with Access. Any input would be helpful.
    It is an excel spreadsheet from an outside source. I use it to prepare an import file into my billing software. I usually use excel to check for updated meter numbers but I was hoping to use Access to do it faster and easier but I'm guessing it's not possible.

  5. #5
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    One macro will do it:
    - import or link to Excel spreadsheet
    - run an update query
    - export using a query back to Excel or into the desired format for your billing software

  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
    Okay, a little confused about data structure. You have a master table in Access associating addresses and meters? Then you get a spreadsheet that has addresses and meters with usage data? You want to update the meters in the master table? Do you want to retain usage data in Access?
    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
    ljksmith is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4
    Every other month I get an excel spreadsheet full of new usage data. It's got the address, meter number and usage data in it. I import the spreadsheet into Access because it's easier to make the import files that way than try to just do it in Excel. I've also been using it to create two queries, one from the previous data and one from the new data then I export it back to Excel and run a formula against the data once I've merged it. What I was hoping that is since I already have the data in Access, run a query that tells me that the meter number for address 123 Main St is not the same in both tables. I'm just not sure how to accomplish this in Access. I use an if formula to do it in Excel. My main goal is to know which meters need to be added in my billing system.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Try a query that links the two tables on the address fields. Then create a field with expression: IIf(Table1!meter <> Table2!meter, "Change", "NoChange"). Apply filter criteria under that constructed field: ="Change" to view only records where meter is different.

    Now if you want to change the meter in Table1 to the new meter from Table2, run an UPDATE action.

    This does depend on the addresses being consistent.
    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.

  9. #9
    ljksmith is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    4
    Thank you! It works great. And I learned something as well.

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

Similar Threads

  1. Replies: 16
    Last Post: 02-01-2016, 05:42 PM
  2. filter subform based on option selection
    By trevor40 in forum Forms
    Replies: 2
    Last Post: 03-06-2014, 07:07 PM
  3. Filter Multiple Forms from one option box
    By chaos_05 in forum Forms
    Replies: 1
    Last Post: 12-02-2011, 10:39 AM
  4. Option button to apply filter
    By catguy in forum Programming
    Replies: 4
    Last Post: 06-23-2011, 12:10 PM
  5. Use Option Group to Filter Combo Box Values
    By dgj32784 in forum Programming
    Replies: 2
    Last Post: 06-06-2011, 12:04 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