Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assign Blank Dates
Message
De
04/07/2000 21:50:12
 
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00387994
Message ID:
00388200
Vues:
20
>>I would like to store a Blank date into a table column that
>>was declared as a date/Time field.
>>
>>I use the INSERT statement to insert a row of record into the
>>Table. How can I specific an empty date?
>>
>>I knew that when inserting a date, I need to quote it with
>>#4/7/2000", what about an empty date? Is it # / / #?
>>But I got error by doing that and also I tried a NULL value
>>also no luck. Any advise, thanks.
>
>Null should work! Which database engine? If Access, is your field Required property set to True.

I'm using Access 2000 and the "Required" field property was set to "No".

Dim dDTCDate As Variant

If chkDTCDate Then 'if required a date
'dtpDTCDate is a Date Picker control, this
dDTCDate = "#" & dtpDTCDate.Value & "#"
Else
''**problem lie here, I didn't put a quote as "Null"
dDTCDate = Null
End If

cnn1.Execute "INSERT INTO CustVisit(IndexNo, DTCDate) " & _
"VALUES('" & dcIndexNo & "'," & dDTCDate & ")"

It is OK now, thank you very much.
Another question, is it alright to declare the "dDTCDate" variable
as a "Variant"? Or should I declare as a "String"? Thanks.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform