"Rick Brandt" <(E-Mail Removed)> wrote in message
news:3ExOh.3717$(E-Mail Removed)...
> SIN wrote:
>> hi,
>> when i insert value (type date) into filed (type date) i get wrong
>> data: example:
>> strSQL = "insert into invoice (Payment_Date)"
>> strSQL = strSQL & " values (" & Me.Payment_Date & ")"
>>
>> even when i use :
>> CDate(Me.Payment_Date)
>> or
>> Me.Payment_Date : date
>> i get: 00:06:27
>> thanks.
>
> Date literals need to be delimited with #.
>
> strSQL = "insert into invoice (Payment_Date)"
> strSQL = strSQL & " values (#" & Me.Payment_Date & "#)"
In addition, if you're using dd/mm/yyyy as your Short Date format (or
others), you'll need to ensure that the date is formatted in such as way
that Access will recognize it correctly.
strSQL = "insert into invoice (Payment_Date)"
strSQL = strSQL & " values (" & Format(Me.Payment_Date, "\#yyyy\-mm\-dd\#")
& ")"
or
strSQL = "insert into invoice (Payment_Date)"
strSQL = strSQL & " values (" & Format(Me.Payment_Date, "\#mm\/dd\/yyyy\#")
& ")"
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)