Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 53
  1. #16
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929

    If still having problem, provide code or db for analysis.
    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.

  2. #17
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Ok, I got the report to pull the employees first and last names from the other table, no problem

    I just can't get it to only pull data from the selected date range at this point.

  3. #18
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Code is in post 11 for the "on click" procedure after a date range is entered.

  4. #19
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    None of which shows adaptation of code example from link referenced in post 9
    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. #20
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    True. I already have a form to select the date, which is what that post describes. My problem isn't that I can't make the date selection form, just that I'm having an issue with it working.

    I am using the same code and the same date-selection form on another report, and it's working just fine. I just can't figure out why it's not on this one...I think it may have to do with the fact that the report I'm using isn't referencing the date the employee was selected as MVR...

  6. #21
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Certainly if data is not in report, can't filter on it.

    Going in circles. Need to review report design and code - if you want to provide db.
    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. #22
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234

  8. #23
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Oh rats - THAT db!!

    Since the report is based on an aggregate query and there is no date field in the query, have dynamic parameters in the aggregate query - the parameters would refer to controls on form for input - I NEVER use dynamic parameterized queries. I think this approach will be too inflexible for what you want.

    SELECT tblRelEventEmployee.EmployeeID, Count(*) AS CountOfYes FROM tblRelEventEmployee
    WHERE (((tblRelEventEmployee.MVR)=True) AND ((tblRelEventEmployee.ShiftDate) Between [enter start date] And [enter end date]))
    GROUP BY tblRelEventEmployee.EmployeeID ORDER BY Count(*) DESC;

    That takes us to the VBA approach from the Allen Browne example - code builds filter string and applies it to report when it opens.
    DoCmd.OpenReport "qryMVR", acViewPreview, , strWhere

    In this approach the report RecordSource would not be an aggregate query. If you want to list ALL employees even if they do not have related records in tblRelEventEmployee:

    SELECT tblRelEventEmployee.*, tblEmployee.FirstName, tblEmployee.LastName
    FROM tblEmployee LEFT JOIN tblRelEventEmployee ON tblEmployee.EmployeeID = tblRelEventEmployee.EmployeeID;

    Now use report Sorting & Grouping features to set up grouping on EmployeeID and do the count in a textbox in group header/footer section: =Count(IIf([MVR]=True,1,0))
    Use the VBA method to build filter criteria.

    Why is MVR in both tables?

    Click image for larger version. 

Name:	MVR.JPG 
Views:	7 
Size:	101.2 KB 
ID:	21889
    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. #24
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Quote Originally Posted by June7 View Post
    Oh rats - THAT db!!
    Yes, sorry. I'd love to rebuild this thing from the bottom up, but that's still a bit beyond my skill.


    Quote Originally Posted by June7 View Post
    Why is MVR in both tables?
    I don't have an answer for that. When I removed it from tblEmployee, even though I thought I removed all relationships, I still was getting a missing parameter error.

    After reading what you wrote, I still have no idea how to make the report only give me the information based on a specific date range. If you look at the main switchboard, and click "reports," and then select MVR Report and hit "Go," it will bring you to a date-selection form. However, regardless of what date range you enter, no dice.

    I'm afraid nothing is any clearer than it was. I know that I have to include the date the MVR label was given on the query/report, but I am no closer to understanding how to do that or how to have it render the data I need.

  10. #25
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    One step at a time.

    Are you able to build the report as described? It's really a very basic functionality.

    Work on dynamic filtering later.

    However, at its simplest the code would be like:

    Private Sub cmdGo_Click()
    DoCmd.OpenReport "qryMVR", acViewPreview, , "ShiftDate BETWEEN #" & Me.txtBeginDate & "# AND #" & Me.txtEndDate & "#"
    End Sub

    Suggest you rename the report.
    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. #26
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    I haven't changed the report, I had planned on using the one that I had already created, with the addition of shift dates to be able to filter it to specific date ranges.

    Also, I did rename the report to "rptMVR"

  12. #27
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You can't add the shift dates to the report because it is based on an aggregate query, unless you want to include the ShiftDate field in the GROUP BY clause and summarize data by ShiftDate.

    So which way do you want to go:

    1. dynamic parameters in aggregate query
    or
    2. report based on raw data and use report Sorting & Grouping with aggregate calc in textbox
    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. #28
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Dynamic parameters in aggregate query. I don't want to confuse my users with additional text boxes. The ultimate goal here is for the user to select the report, enter a month, and see who was selected as MVR most for that particular month.

  14. #29
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    What additional textboxes? Both methods use the same user inputs. What they don't see is how you use their inputs.

    Did you try the dynamic parameters?
    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. #30
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    I didn't, because I don't know how to. I read the info at the link you supplied, and I wasn't able to reconcile it with what I'm doing in my mind. And at this point, I'll go with whatever method is the easiest to set up.

Page 2 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-31-2015, 02:44 PM
  2. Create a "Totals" row for each column in crosstab
    By accessnewbie352 in forum Queries
    Replies: 13
    Last Post: 01-06-2015, 12:28 PM
  3. Replies: 3
    Last Post: 04-29-2014, 04:49 PM
  4. Column sum works in "Detail" but not "Footer"
    By Doodlebug2000 in forum Reports
    Replies: 1
    Last Post: 12-10-2012, 03:20 PM
  5. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 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