Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    mnickell is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    13

    Maybe its not possible?

    I have created a form that will run a query for my company interentiry transactions reports. I have to be able to pull an unsure amount of Entities over a range of time. Ex. I need to be able to enter Entiy 1000, 1008, 1009 and possibly more or different entitys from lets say January to March and then run a report off of that query. I can get the Entity part to work if I do filter by form, but not the dates, and if I do not do filter by form I can get the dates to work but not the entities. Is it possible to do both of these things at the same time?



    Thank you for any insight possible

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    If you also want to do both and 1 filter of each...
    Filters:
    dates only
    entities only
    dates and entities

    The filter may have to do some logic when user clicks a 'go' button:
    Code:
    select case true
       case not isnull(txtEntity)  and  not isnull(txtStartDate)
          vFilter = "[entity] ='" & txtEntity & "' and [date] between #" &  txtStartDate & "# and #" & txtEndDate & "#"
    
       case not isnull(txtEntity)
          vFilter = "[entity] ='" & txtEntity & "'"
    
       case not isnull(txtDateStart)
          vFilter = "[date] between #" &  txtStartDate & "# and #" & txtEndDate & "#"
    end select
    
    me.filter = vFilter
    me.filteron = true

  3. #3
    mnickell is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    13
    Ill be completly honest I don't exactly understand how all of the logic and coding stuff works as I am an average access user on my best day. Could you possible expand on the logic slightly more so that I have a boarderline idea of what I need to do?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Review:

    http://allenbrowne.com/ser-62code.html

    For selecting multiple Entities, review:

    http://allenbrowne.com/ser-50.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.

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    If you are filtering your data based on what the user picks on the form,
    then you need a button to execute the filter.

    The filter may be:
    date only,
    entity only,
    or both, so the code does this.

    On the button _afterUpdate event, paste this code in it.

  6. #6
    mnickell is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    13
    I appologize I am still having trouble getting it to work properly. Should I just create a new button and paste that code into the new button

  7. #7
    mnickell is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    13
    Or is there anyway you could try and create what you are talking about and reattach a new file

  8. #8
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    EnitiesExample.zip

    Examine the Entities test attached.

  9. #9
    mnickell is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    13
    Thats close to what I need. I think my database has something similar currently. Im not sure if I was doing it wrong or what but I need to be able to select the different entities first and then by date. Not find the entities that fall within that range of dates.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What does that mean? You want criteria to allow for multiple entities and multiple dates? So a record must meet the entity and date criteria? Like:

    WHERE Entity IN (1000, 1008, 1009) AND [Datefield] IN (#1/1/2014#, #2/1/2014#, #3/1/2014#)
    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.

  11. #11
    mnickell is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    13
    Yes. Basically I need one form with a multi-select to pick and chose what entities I need to pull up for my report and then also need to be able to chose the dates for those entites. The format of the Dates (1/1/2013) technically are just an entire month there is not day-to-day dates. They could just say (Jan, Feb, Mar). It was the format I was given but can be changed.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Sounds like you need 2 listboxes and the code described by Allen Browne in the second link I referenced in earlier post.
    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.

  13. #13
    mnickell is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    13
    I think (not sure) I would be able to just use a simple where function if I only needed to use the form once but I need to be able to go back and use it multiple times and select different entities (which could be more or less entities) over a possibly different range of dates

  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
    Then more like:

    WHERE (Entity IN (1000, 1008, 1009) AND [Datefield] IN (Jan, Mar)) OR (Entity IN (1010, 1019) AND [Datefield] IN (Aug, Nov, Dec))

    That's getting really complicated and beyond anything I've ever tried to program.
    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
    mnickell is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2014
    Posts
    13
    Ok so yesterday I had the form set up to run the between function on the date field and it was working but my problem was being able to use the multi select box as criteria for the entity field at the same time. There has to be able to run the query that way correct. The two criteria dont have to be based in the same field I just need to be able to run them both at the same time. I can use the between function and pull up every entity between the range of dates I need but I need to be able to also use the multi select box and get only the entities I need. I dont know if that helps or not. I think I may be making it sound like more of a complicated problem than it probably is because I am not the greatest with access

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

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