Page 1 of 1

storing date dbpro - ms access

PostPosted: Thu Dec 11, 2014 7:26 am
by yanzco
i was wondering

i took variable in neobook the date..
and stored it to ms access field with data type (date/time)

opened ms access and its stored in numbers like 1234789417247

how do i store
MM/DD/2014 only

and
3:15pm only


other workaround i did to my other program was set data type to "text"..
wednesday 12/11/2014

works ok, but i cant sort ascending / descending the dates properly..
it sorts to alphabetically..

so this time, im trying to make it work with data type "date/time"
but i cant seem to make it work properly..
the variables are way off.. or probably correct, but ms access just reads it different way..

Re: storing date dbpro - ms access

PostPosted: Thu Dec 11, 2014 8:05 am
by stu
What version of Access? can you provide a sample db?

Access! :evil:

Re: storing date dbpro - ms access

PostPosted: Thu Dec 11, 2014 8:19 am
by Gaev
yanzco:

i took variable in neobook the date..

Do you mean that you did something like ...
Code: Select all
DefineVar "[Birthdate]" "Date" "mm/dd/yyyy" "Global" "01/23/1914"

If so, try ...
Code: Select all
NumToDate "[Birthdate]" "m/d/yyyy" "[FormattedDate]"

... then pass [FormattedDate] to the Access DB field.

stored it to ms access field with data type (date/time)
how do i store
MM/DD/2014 only

and
3:15pm only
Not sure how you can define time in NeoBook's Date type variable ... but you might try appending the time to [FormattedDate] before passing it to the Access DB field.

other workaround i did to my other program was set data type to "text"..
wednesday 12/11/2014

works ok, but i cant sort ascending / descending the dates properly..
it sorts to alphabetically..

You can store two fields in the Access DB ... the first one like you have (text field with MM/DD/YYYY for human consumption) ... and another (hidden from user view) that contains the the variable used with DefineVar ... in above example [Birthdate (whose value like 1234789417247 is the "elapsed number of days since some very old date like December 31, 1899") ... do your sorts on the second field

Re: storing date dbpro - ms access

PostPosted: Thu Dec 11, 2014 8:52 am
by yanzco
access 2002-2003

ill try and see if it works guys..

Re: storing date dbpro - ms access

PostPosted: Thu Dec 11, 2014 12:45 pm
by Neosoft Support
NeoBook may be misinterpreting the date as a mathematical formula. For example:

12/11/2014

might be seen by NeoBook as:

12 div 11 div 2014

To prevent this add an exclamation point character (!) in front of the date. For example:

SetVar "[MyDB.Table.DateField]" "!12/11/2014"

or

SetVar "[MyDB.Table.DateField]" "![DateShort]"