Results 1 to 4 of 4
  1. #1
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    187

    Forms and Subforms

    I have a tool I've built to schedule a production line.
    When looking at this, think of a calendar.

    I have a main form, which has a combo box to pick a line we are scheduling. This is simply a box used as a filter.

    On this main form, are several subforms, which reprent the days of the week.
    I have 14 subforms. This works perfect for my project.

    What I've done, is created a form, basically filtering by date. Subform are records for Date(). My subforms are named Day_1, Day_2, Day_3, etc.
    What I need to happen, is that the first form, is always Sunday, and the next form is always Monday, and so on through Sat.
    Then on the second row, I would want to start again.

    The issue I see, is I'm applying a filter calling out Date() for subform Day 1 and Date ()+1 for subform Day_2 and so on. The subforms are specific so it's always going to be Day_1 = Date() in the first form. No matter what day of the week it is.

    I am not sure how to change it so the first subform is Sunday...



    I know this sounds confusing, so please ask me what you need me to clairfy. I'm sure it's not difficult. I did this years ago, I believe, and just can't seem to put my thumb on how I did it.

    Thank you in advance!!!!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    This should give you the Sunday of the week you're in:

    date() - Weekday(date(), vbSunday) + 1

    You can populate a textbox with that and leverage the subforms from there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    187
    Thank you, again, pbaldy! You've help me quite a bit awhile back! Good to see you're still here!
    I'm not sure if I've fried my brain today with this database, or what... I don't understand what you're saying.... perhaps becuase I didn't explain what I was doing, properly, I'm assuming... lol

    I have this table with all the dates we schedule to build orders on. My subforms are filtered by using a Date() calculation... so, subform one is date() meaning today. The next subform is date()+1, etc...
    I have them laid out, 7 subforms across...
    I do not need the first one to be filtered by date(), right? Can I use the code you offered as the filter or a form of that code to give me the sunday date in the first form.

    So, when I open the form and go to the property sheet for datasource, I can change date() to the code you provided, and then the second subform, there's something for monday of the current week?
    Something along these lines?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    What I would probably do is set the value of a textbox to that value in code, and base on the subforms on that textbox (+1 for the second subform, etc). That way you can have the ability to set it to next week's Sunday and everything flows from there (like if the user wants to be able to view other periods).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Linking forms without using subforms
    By tomnsd in forum Forms
    Replies: 3
    Last Post: 01-22-2013, 12:41 PM
  2. Replies: 5
    Last Post: 01-16-2013, 03:48 PM
  3. Replies: 5
    Last Post: 10-27-2011, 01:00 PM
  4. forms and subforms
    By phineas629 in forum Forms
    Replies: 4
    Last Post: 10-05-2011, 02:46 PM
  5. Help with Forms and Subforms
    By xstaceyid in forum Forms
    Replies: 1
    Last Post: 04-21-2011, 02:14 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