Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    BusDriver3 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    46

    Schedule Report... maybe?


    Hello,
    I am trying to create a report in Access that that is based on a starting date and an ending date. Ultimately the report will depict the work-center personnel schedule. The information will be entered via a form and the finished product/report would look like the attached file. Does anyone if this is even possible or how to do it? Any help with this would be great. Thanks
    Please see attached file.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Here's a simple example, it won't work if you put in a non 31 day month but the very simplest thing to do is to have four different reports for each month type (28,29,30,31) then just figure out how many days the current month has before you open a report and open the appropriate report. I'm not going to mess around with deleting controls etc if you want to go that far you can.

  3. #3
    BusDriver3 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    46
    Wow ! This is great !! Thanks ... I tried to add a new person via the table but when I did and ran the macro it cleared the tblReportSetup table...

    Question: how does the frmReportSetup know which ID to update?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Very nice rpeare. I am sure could be coded to handle the varying length months and need only one report object but would be a lot more complicated.

    BusDriver3, the tblReportSetup is a temp table, meaning it retains data as needed only for the procedure and is purged each time the procedure runs. Anytime records are added to the permanent tables, this procedure will have to be run again so the temp table will update. I tested adding another record to tblPeople and tblSchedule and ran the procedure. It works. Safest thing to do is have the procedure run as part of the procedure that opens the report. Open report by button click on a form.

    Note that this is VBA, not a macro.

    This will not prevent records in tblSchedule with overlapping dates for the same person.
    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
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    June did a good job of describing so I'll leave it there, I just think I forgot to add the 'open report' command after running the macro that's attached to the button (I can't recall at the moment and I'm on my way to bed so I'm not going to look!) If you just add a line of code at the very end of the ON CLICK event code that's

    docmd.openreport <insert report name and preview/print option>

    then it should be seamless to the end user as to what's going on.

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    one other thing
    Question: how does the frmReportSetup know which ID to update?
    It doesn't know which ones to update, in order to create a line for all of your drivers (which I assumed you wanted rather than only those who have time off during the given month) you basically have to create a record for every driver for every day of the month. From there it's a simple crosstab query to do the bulk of the work, though as june pointed out it will *not* work if you have a person who has an overlapping day off type.

  7. #7
    BusDriver3 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    46
    This works, thanks for your help on this!

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Hate to throw a wrench into the works but I did some more testing. I picked date range of 8/2/2011 to 8/31/2011 and the code fails. The range must include or extend beyond the first and last days of month. Also, I entered a record in tblSchedule with range of 8/15/2011 to 9/5/2011 and then selected report range 8/1/2011 to 9/1/2011. The report shows an OffTimeCode for day 1 but since none of the days show the month, it is not clear that this report is crossing months.

    Suggest instead of having user select date range just have them select a month then in code construct the date range to be the first and last days of that month.

    Check out this revision. It will handle all months and only one report object needed. Wasn't as more complicated as I thought it would be.

    Textbox conditional formatting can handle only 3 conditions (EDIT: Access 2010 expanded to 50 conditions), which is fine for 3 OffTime types. But if you have more, suggest simply displaying the textbox value and have the legend show codes instead of colors.

    If you split the project, temp table should be in the frontend, not a linked table.

    If you need something more complex, such as allowing for ranges crossing months, suggest Google search for some projects already built. Might find a freebie out there. This report is like a project management scheduler. I know specialized (and probably expensive - SAP is one) software exists for that, an example might be MS Project (never worked with). I also see Excel used for this.
    Last edited by June7; 08-21-2012 at 05:22 PM.
    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
    joncage is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Apr 2014
    Posts
    2

    How did you get background colors to change?

    Hello, I opened your bus example. very nice. I don't seem to see any code on the report that would instruct the text box to color itself anywhere depending on the data, 1,2 or 3. I created a 4th category but number 4 just shows up in txt box? How did you "color" textbox backround based on data values? I suppose I could write a simple function during the onformat event but I did not see where you did this anywhere...HOW did you do that?

    Cheers
    joncage


    Quote Originally Posted by rpeare View Post
    Here's a simple example, it won't work if you put in a non 31 day month but the very simplest thing to do is to have four different reports for each month type (28,29,30,31) then just figure out how many days the current month has before you open a report and open the appropriate report. I'm not going to mess around with deleting controls etc if you want to go that far you can.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Conditional Formatting. http://www.techonthenet.com/access/f...ond_format.php

    Limited to 3 conditions until Access 2010
    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
    joncage is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Apr 2014
    Posts
    2
    Wow...been programming in access for a long time and never used that before...thx!

    Quote Originally Posted by June7 View Post
    Conditional Formatting. http://www.techonthenet.com/access/f...ond_format.php

    Limited to 3 conditions until Access 2010

  12. #12
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    2 years old and still getting traction!

    I went back and looked at the original example and there are a bunch of overlooked completely! what a sloppy example who the hell wrote that thing anyway!

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What happened to the attachments? Now I find myself wanting to see this example db again and can't find it. Was hoping to download.
    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.

  14. #14
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Without the name I don't know. Is there a way to tell the date on your attachments, You can sort by the date, but I don't see a way to view the actual date. If I can see that I can likely pull it up, I don't think I've ever deleted attachments.

    edit
    nm got it looking now

  15. #15
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Sorry june, looks like older attachments are deleted by the board. I don't have anything prior to calendar year 2012. Was there something specific to work out?

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

Similar Threads

  1. Time Schedule display in access
    By snoopy2003 in forum Database Design
    Replies: 3
    Last Post: 03-23-2011, 04:41 PM
  2. Schedule Conflict Coding
    By mann2x in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 09:52 AM
  3. Flight schedule
    By t_g2 in forum Database Design
    Replies: 1
    Last Post: 01-20-2010, 01:13 PM
  4. any way to schedule a compress/repaor task?
    By Coolpapabell in forum Access
    Replies: 7
    Last Post: 10-07-2009, 02:08 PM
  5. Schedule Preparation
    By crapmind in forum Programming
    Replies: 0
    Last Post: 03-08-2009, 09:05 AM

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