|
-
November 12th, 1999, 03:40 PM
#1
Nulls in a Date field
I need to load null values into a MSACCESS date field defined as DATETIME and my VB program is blowing up with an error code 3421 - Data type conversion error. Is there anyway to load null values into a field defined this way?
Regards,
Luanne Benedict
-
November 13th, 1999, 01:26 AM
#2
Re: Nulls in a Date field
Have you actually tried using the Null Value? ,e.g.
private Sub Command1_Click()
Dim oDB as Database
Dim oRS as Recordset
set oDB = Workspaces(0).OpenDatabase("DB1.mdb")
set oRS = oDB.OpenRecordset("SELECT * FROM Table1 WHERE ID=0", dbOpenDynaset)
oRS.AddNew
oRS("DateTimeField") = null
oRS.Update
set oRS = nothing
oDB.Close
set oDB = nothing
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
November 15th, 1999, 07:11 AM
#3
Re: Nulls in a Date field
No I hadn't tried that, but I did and it worked great. Why would rs.[datefield] = "" not work?
Regards,
Luanne Benedict
-
November 15th, 1999, 06:38 PM
#4
Re: Nulls in a Date field
Luanne,
Because "" is not null, it's an empty string. Which are two entirely different things to Access. Date fields in Access will not accept an empty string...
-
November 16th, 1999, 07:16 AM
#5
Re: Nulls in a Date field
Thank you both for your help. It's much appreciated!
Regards,
Luanne Benedict
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
|