Results 1 to 4 of 4
  1. #1
    vlc1982 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    2

    Possible to populate a field for several new records with a date entered in textbox on a form?

    Hello,



    I'm a CPA, not a person who is extremely familiar with macros or code, so keep that in mind:

    I have a form with a text box where the user enters a date and then clicks a button titled "Add." I've added an on-click event to the Add button that runs an append query that adds several records to a table [tblTracking]. I have a field in tblTracking called EndDate. I want the date that's entered into the text box by the user to be populated into all the new records added to the tblTracking when the append query is run. Currently, all fields in tblTracking are populated when the append query is run, except the EndDate field.

    Is this possible? If so, how?

    I've experimented with adding a separate on-click event that adds a record to a separate table containing only the date entered in the textbox and an auto-populated ID field. I thought there might be a way to utilize the ID field to pull the associated EndDate into the Tracking table, but I can't figure that out, either, since I don't know how to tell it to look at the date field in the last record of the table. That sounds unsafe anyway. Any suggestions are appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    You should be able to add the field to your append query, and get the date from textbox. In design view, you'd have a reference to the textbox in the "Field" row of the query:

    Forms!FormName.TextboxName

    Access will add an alias to the beginning, which you can edit or ignore (the default would look like "Expr1:").
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    vlc1982 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2015
    Posts
    2
    Worked perfectly. Thanks for your help!

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No problem, and welcome to the site by the way!
    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. Replies: 1
    Last Post: 08-10-2014, 04:06 PM
  2. Replies: 1
    Last Post: 08-05-2014, 12:40 PM
  3. Replies: 9
    Last Post: 06-20-2014, 12:27 PM
  4. Replies: 5
    Last Post: 01-10-2013, 11:38 AM
  5. Replies: 4
    Last Post: 04-26-2012, 09:46 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