Results 1 to 4 of 4
  1. #1
    AKQTS is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2010
    Posts
    56

    Append Query: Time Stamp

    Here is waht I am trying to accomplish:

    When a button is pressed, the current time is inserted into a field in a table.

    How I am trying to accomplish this:

    INSERT INTO Cleaning_Batch_Parameters ( Cleaning_Time_In )
    SELECT Time$() AS Expr1
    FROM Cleaning_Batch_Parameters
    WHERE (((Cleaning_Batch_Parameters.pkOrderBatchID)=[Forms]![Dashboard]![Dashboard_sub]![pkOrderBatchID]));

    This query is on a macro that is opened once a button is pressed.

    I am getting a key violation everytime I run this though.

    The appropriate fields are referenced to input the value into the correct record on the table. The table field the time is inserted to is set to text (I don't know if that matters).

  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,521
    Are you trying to create a new record (row)? That's what that code would do. I suspect you want this:

    UPDATE Cleaning_Batch_Parameters
    SET Cleaning_Time_In = Time()
    WHERE pkOrderBatchID=[Forms]![Dashboard]![Dashboard_sub]![pkOrderBatchID]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    AKQTS is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2010
    Posts
    56
    Thanks it works. Thread marked solved

  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,521
    Happy to help!
    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. Append Query (Maybe VBA?)
    By justinwright in forum Queries
    Replies: 14
    Last Post: 07-21-2010, 10:31 AM
  2. Question about Button and Time Stamp
    By euroclyde in forum Access
    Replies: 2
    Last Post: 06-16-2010, 09:01 AM
  3. Time Stamp Removal/deletion?
    By thorsonb in forum Access
    Replies: 3
    Last Post: 03-30-2010, 10:17 PM
  4. Append query won't append
    By yelkenli in forum Queries
    Replies: 5
    Last Post: 02-12-2010, 11:19 AM
  5. Replies: 4
    Last Post: 01-30-2010, 05:22 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