Insert into date not working (1 Viewer)

luvsmel

New member
Local time
Today, 00:52
Joined
Nov 10, 2015
Messages
7
Hi All,

I haven't had an opportunity to work in Access for a few years and am rusty beyond belief. :banghead:

I am trying to insert a date from a unbound textbox in a form to a table. Both the textbox and the table field are set to shortdate format. I've confirmed that everything else works if I take the date out so I have only posted the variables for the date.

Dim itxtDate As Date
itxtDate = Me.txtDate

strSQL = "INSERT INTO tblMasterTrainingCourses (Trainer1, Trainer2, Application, EpicClass, Location, EnrollNumber, StartTime, EndTime, CapstoneCourse, Date) " & _
"VALUES ('" & icmbCT1 & "','" & icmbCT2 & "','" & icmbApp & "','" & icmbClass & "','" & icmbLoc & "','" & itxtEnrollNum & "','" & itxtStart & "','" & itxtEnd & "','" & itxtCapstone & "', #" & itxtDate & "#);"
DoCmd.RunSQL strSQL

Any help would be greatly appreciated.

Thanks, Mel
 

luvsmel

New member
Local time
Today, 00:52
Joined
Nov 10, 2015
Messages
7
Thank you SOOOO much. I changed the tables field name to ClassDate and it worked right away. :)

Mel
 

JHB

Have been here a while
Local time
Today, 08:52
Joined
Jun 17, 2012
Messages
7,732
You're welcome - take care of the reserved words it may cause unexpected result.
 

Users who are viewing this thread

Top Bottom