[AccessD] Import Excel Dates into Access

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Tue Oct 14 20:29:27 CDT 2003


Mark, its simply int(date) I gave an example below; however note that it
will automaticly make the date equal 12 midnight of that day. sometimes
its not useful.

Private Sub Command1_Click()
Dim a As Date
Dim b As Date
Dim c As Date
Dim d As Date

a = #12/12/1987 12:06:00 PM#
b = "07/09/2002 07:56:43 AM"

c = Int(a)
d = Int(b)

MsgBox (c) 'will give you 12/12/1987
MsgBox (d) 'will give you 7/9/2002 (not it ignores leading zeros)

 Thank you so much Stuart.  You are absolutely right.  Even a right click
> 'filter by selection' will not result in matches for the same date
> because of the time differences.  I've never used Int() with dates
> before and could not find an example in MSDN.  Can you provide an
> example syntax?
>
> TIA,
>
> Mark
>
>
> -----Original Message-----
> From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg]
> Sent: Tuesday, October 14, 2003 5:41 PM
> To: Access Developers discussion and problem solving
> Subject: RE: [AccessD] Import Excel Dates into Access
>
>
> On 14 Oct 2003 at 16:25, Mitsules, Mark wrote:
>
>> Oleg_123,
>>
>> Thanks for the reply.  I went ahead and implemented your
>> suggestion...setting the destination field format to Short Date.  When
>>  the format is set to General Date the previous records do not have a
>> time component.  Does the "Short Date" approach have any negative
>> implications? Could it cause any impact to date calculations used in
>> criteria?  I hope not...
>>
>
>
> The display format doesn't have any effect on the underlying data so
> won't affect date calculations.
>
> It can however mislead you into making errors in you criteria.
>
> If you are displaying Date/Time records just as a date, you may be
> fooled into thinking that they only contain date info.  If the
> underlying data is "15 Oct 2003 07:30",  you will not get a match if
> you filter for Date = "15 Oct 2003"
>
> If you only want the date part, you should strip off any fractional
> (time)  part when importing the data using Int()
>
>
> --
> Lexacorp Ltd
> http://www.lexacorp.com.pg
> Information Technology Consultancy, Software Development,System
> Support.
>
>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail




More information about the AccessD mailing list