Reputation: 375
I need some help with my query I am trying to insert to a table see above code:
CurrentDb.Execute ("INSERT INTO tblWarehouseItem ( whiwrhID, whiItemName, whivatName," whiVatRate, whiimtID, whiQty, whiPrice, whisupID, whiDateIn, whiExpiryDate,whiwhiID ) " & _
" Values (" & rs!WID & "," & Chr(34) & rs!N & Chr(34) & "," & Chr(34) & rs!VN & Chr(34) & "," & rs!VR & "," & rs!IID & "," & intQtyForm & "," & rs!PR & "," & rs!SID & "," & CDate(rs!DIN) & "," & CDate(rs!EXD) & "," & rs!ID & ")")
In my table the CDate(rs!EXD)
and CDate(rs!DIN)
are stored as time.
When I compile my query in the immediate window I get Dates.
INSERT INTO tblWarehouseItem ( whiwrhID, whiItemName, whivatName, whiVatRate, whiimtID, whiQty, whiPrice, whisupID, whiDateIn, whiExpiryDate,whiwhiID ) Values (2,"ITEM10","A",19,14,4,20,10,21/07/14,26/05/14,60)
How can I make my query to insert the date in the table?
thanks in advance
Upvotes: 0
Views: 626
Reputation: 175748
If you run that 21/07/14
is passed to Access and interpreted as an integer resulting from 12 divide by 7 divide by 14
which when converted to a date is just a time.
Delimit dates with #
:
.. ",#" & CDate(rs!DIN) & "#," ..
Upvotes: 2