Guest_imported
New member
- Jan 1, 1970
- 0
Can't seem to find an answer for this anywhere.
I am trying to insert a date into a microsoft access 2000 table. The field I am attempting to insert into is a date/time field. I know how to do this with the ado control but I have a specific situation where I need to execute an insert statement with SQL. I have successfully inserted with SQL in all fields but the date/time field. I understand the difference between Update and Insert, and I realize that the primary key must not be null. I have tried to use the CDate functions and other creative solutions but to no avail. How do I mask the date from visual basic so that it will successfully insert/update into access 2000? Here is the code that I am trying to use. Thanks in Advance![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
txtdate.Text = Date
Dim mstrInsertSQL As String
Dim strDateMask As String
strDateMask = CDate(txtdate.Text)
mstrInsertSQL = "Insert Into MyTable (datefield) Values('" & strDateMask & "')"
Data1.Database.Execute mstrInsertSQL
Any ideas???
I am trying to insert a date into a microsoft access 2000 table. The field I am attempting to insert into is a date/time field. I know how to do this with the ado control but I have a specific situation where I need to execute an insert statement with SQL. I have successfully inserted with SQL in all fields but the date/time field. I understand the difference between Update and Insert, and I realize that the primary key must not be null. I have tried to use the CDate functions and other creative solutions but to no avail. How do I mask the date from visual basic so that it will successfully insert/update into access 2000? Here is the code that I am trying to use. Thanks in Advance
txtdate.Text = Date
Dim mstrInsertSQL As String
Dim strDateMask As String
strDateMask = CDate(txtdate.Text)
mstrInsertSQL = "Insert Into MyTable (datefield) Values('" & strDateMask & "')"
Data1.Database.Execute mstrInsertSQL
Any ideas???