Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8117087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:02:57+00:00 2026-06-06T04:02:57+00:00

I am in the process of implementing an audit log to record a brief

  • 0

I am in the process of implementing an audit log to record a brief description of changes to the database. My audits table consists of an autonumber PK, empID(number), Description(memo), and auditDate(date/time). My empID and description are being properly inserted without throwing errors, but my date/time is not being inserted. I am thinking this may not be as simple as misplaced quotation marks. My VBA code is as follows:

in the afterInsert event:

Dim strQuery As String
'Dim js As Integer
Dim currDateTime As Date
currDateTime = Now()


strQuery = "INSERT INTO Audits ([emp Number], Description, dateofAudit) VALUES (" & Me.empID & ", '" & "insertion" & "'," & currDateTime & " )"


CurrentDb.Execute (strQuery)

Like I said, I can get the first three values in fine, but when I attempt to insert the date time, I run into problems. Any input is appreciated. Hopefully this is not as simple as misplaced quotation marks, as I tried about 4 variations of quotation mark placement before submitting this question:)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:02:58+00:00Added an answer on June 6, 2026 at 4:02 am

    Try it this way.

    strQuery = "INSERT INTO Audits ([emp Number], [Description], dateofAudit)" & _
        vbCrLf & "VALUES (" & Me.empID & ", 'insertion', Now())"
    

    Also give yourself an opportunity to examine the finished text string.

    Debug.Print strQuery 
    

    With that approach, you wouldn’t need your currDateTime variable. The Date/Time value would be determined when the db engine evaluates the Now() function … the time at which the INSERT statement is executed.

    If you want the time as per your original approach, format currDateTime and add # delimiters.

    strQuery = "INSERT INTO Audits ([emp Number], [Description], dateofAudit)" & _
        vbCrLf & "VALUES (" & Me.empID & ", 'insertion', " & _
        Format(currDateTime, "\#yyyy-mm-dd hh:nn:ss\#") & ")"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a JPA-like process: all classes representing a table must subclass a DBTable
I'm currently in the process of implementing a number of different assignment algorithms for
Am in the process of implementing a fairly conventional shopping checkout flow. Currently it
I am in the process of implementing jQuery, and taking out Prototype libraries in
I'm implementing a process elevation helper for Windows. It's a program that will run
I'm implementing a php interface to process a .php file containing a bunch of
I'm having some problems implementing an algorithm to read a foreign process' memory. Here
What is the reliable way of implementing bidirectional communication to a Linux process? I
I'm looking for a reliable way of implementing a callback on a forked process,
I'm in the process of implementing in-app billing and I'm using the Dungeons app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.