Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Calendar Seminar Lessons    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
TimeDate Insert IntoSQL Error
Ashlyn Talley 
    
4 years ago
Hello  Ive both taken and put to use ALZs Calendar Seminar. I used for the most part the field names for my own table and queries from the training videos.  Everything has been working as expected except now when I need to perform an SQL INSERT INTO with an event triggered from a form. The field that seems to be generating the error is the same [DateTime] field used throughout the training. SQL must see that as a reserved word?

(PatientID is a long, DateTimeAdd is dimensioned as a date)
Using the same variables, Im able to successfully enter a record using:
CurrentDb.Execute "INSERT INTO tsh_TempT (PatientID, DateOK) VALUES (" & PatientID & ", #" & DateTimeAdd & "#   )"

But receive an error when I switch to the needed field to DateTime
CurrentDb.Execute "INSERT INTO tsh_TempT (PatientID, DateTime) VALUES (" & PatientID & ", #" & DateTimeAdd & "#   )"

I built a test table and copied the field name from the table into the above statement, when DateTime is used it seems to continue to generate a syntax error. Any suggestions?
Adam Schwanz  @Reply  
           
4 years ago
Should just be able to do [DateTime] but yes DateTime is a reserved word.
Adam Schwanz  @Reply  
           
4 years ago
Brackets around tells Access it's a field name, but I would rename your field for simplicity, remembering to do that everywhere is annoying.
Alex Hedley  @Reply  
           
4 years ago
Glossary: Reserved Words

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Calendar Seminar Lessons.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 4:36:14 PM. PLT: 1s