Results 1 to 5 of 5
  1. #1
    Help! is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2014
    Posts
    3

    Form to automatically add new records with default values

    I'm trying to create a form that will add 7 records to my hours table (1 for each day of a specified week; Startdate to Enddate) for each record of an employee query.

    I tried using a continuous subform for each employee with default data for #of hours and type. The problem is the date. If have to click on the calendar and click the date for each of the seven days for each employee. (appoximately 560 times) Carpal Tunnel!

    Is there any way to get the dates to programatically appear based on StartDate, Startdate + 1, StartDate + 2 and so on till the EndDate?


    My other idea is to make an Append query for each employee and each date. Does anyone know if thats possible?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Yes, can use VBA code to run APPEND action.

    Is there any other data besides employeeID, date, hours, type entered for each record?
    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.

  3. #3
    Help! is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2014
    Posts
    3
    Yes that's it.

    Also I've never gone near VBA Code.

  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,771
    This about the 4th thread I reviewed today with requirement to programmatically create records.

    Macros can run an Access action query object but looping structure with a macro is not easy. And for what you want, don't event think about it.

    So you have a lot to learn. Need understanding of basic programming concepts, VBA language/syntax, SQL, opening and manipulating recordsets in VBA.

    Another approach is to programmatically modify the DefaultValue property of a control. However, this requires that a record be initiated by entering some value into another field. New record initiation triggers the DefaultValue. So would still have to do data entry of 7 records for each employee.
    http://access.mvps.org/access/forms/frm0012.htm
    http://allenbrowne.com/ser-24.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
    Help! is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2014
    Posts
    3
    I do have programming experience with DOS and some SQL, but you put me on the right track and I thank you.

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

Similar Threads

  1. Default values in a form
    By Aleem in forum Access
    Replies: 5
    Last Post: 12-11-2013, 04:39 PM
  2. default values in a form
    By kmims44 in forum Forms
    Replies: 9
    Last Post: 06-28-2012, 12:35 PM
  3. Replies: 4
    Last Post: 03-15-2012, 03:26 AM
  4. Default Values In Form
    By ASW in forum Programming
    Replies: 2
    Last Post: 01-18-2012, 08:55 AM
  5. Default Values in a form
    By handjor in forum Forms
    Replies: 3
    Last Post: 08-03-2011, 09:11 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