Results 1 to 2 of 2
  1. #1
    vibinmvenugopal is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2014
    Posts
    4

    Make rows in a subform based on a date entered in the Main Form


    I have a text box field to enter start date.

    Once the start date is calculated, the access should calculate the next 10 working days and auto populate those days in a sub form.

    Is this possible?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    yes it's possible.

    it will need to populate the underlying table to the subform. Assuming

    1. working days means Mon-Fri and you are ignoring holidays
    2. 'next 10' means start date plus another 9 days (10 days in total)

    then some code in the unbound textbox afterupdate (or perhaps better on a button click event) would be something like

    Code:
    dim I as integer
    dim j as integer
    I=0
    j=0
    while I<10
        if weekday(nameoftextboxhere+j,vbmonday)<6 then 
            currentdb.execute("INSERT INTO myTable (wDate) Values(#" & format(nameoftextboxhere+i,"mm/dd/yyyy") & "#")")
            I=I+1
        end if
        j=+1
    wend
    mysubformcontrolnamehere.requery
    mysubformnamehere.form.filter="[WDate]>=#" & format(nameoftextboxhere,"mm/dd/yyyy") & "#"
    mysubformcontrolnamehere.filteron=true
    tip, set format of your textbox to short date to enable the calendar selector

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

Similar Threads

  1. Replies: 11
    Last Post: 06-28-2015, 06:42 PM
  2. Replies: 2
    Last Post: 05-22-2014, 06:11 PM
  3. Replies: 3
    Last Post: 12-17-2013, 10:10 PM
  4. Replies: 8
    Last Post: 10-26-2012, 09:17 AM
  5. Replies: 3
    Last Post: 12-01-2011, 06:51 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