-
November 24th, 2010, 01:44 PM
#1
[RESOLVED] how to insert null date
Hey everyone. I have some date fields that I want to not have any dates during a record creation. I figured the way to go would be to insert NULL. The way I'm going about it now gives me a Type mismatch error. How do I go about doing this? VB 2008 Standard/Access 2007
Code:
command.CommandText = "INSERT INTO IssueTbl(HardwareID,SoftwareID,Description,OpenedDate,AssignedDate,ClosedDate) " & _
"VALUES('" & selHardware & "', " & _
"'" & selSoftware & "', " & _
"'" & Me.txtDescription.Text & "', " & _
"'" & Now & "', " & _
"'" & DBNull.Value & "', " & _
"'" & DBNull.Value & "')"
Last edited by viperbyte; November 24th, 2010 at 01:46 PM.
Reason: Forgot to mention IDE and database
-
November 24th, 2010, 01:46 PM
#2
Re: how to insert null date
The DB has to have NULLABLE types. That's a bad way to initialize a date, though. Create one from 100 years ago, or 1000.
-
November 24th, 2010, 03:29 PM
#3
Re: how to insert null date
I used the 1000 years approach. That worked but I hope to one day know how others feel about how to setup a datetime field that won't have real information in it till the future. Thanks for the suggestion.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|